Working with Python and R in Vertica

Bryan_HBryan_H Vertica Employee Administrator
edited December 2019 in Tips from the Team

Here are some notes on Python and R resources for Vertica:

Vertica academy - recorded and live training

Sign up at https://academy.vertica.com/

Live training on Python for Vertica and Machine Learning scheduled for December 12: https://academy.vertica.com/course?courseid=verticamlwebinar

Python client

Python client installation and basic examples at https://github.com/vertica/vertica-python

Vertica doesn't include graphical tools so a front end like Jupyter Notebook is necessary to show graphs.

Python UDx is documented at https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/ExtendingVertica/UDx/DevelopingUDxs.htm

  • The documentation is largely the same regardless of exact Vertica version.
  • Vertica 9.x ships with Python 3.6 so any Python scripts should be compatible with Python3 syntax - such as print() statements, etc.

There are several examples in the Vertica installation under /opt/vertica/sdk/examples/

  • The SQL files PythonScalarFunctions.sql and PythonTransformFunctions.sql show how to install and run the Python UDx examples

There is a Python UDx example showing how to implement Fast Fourier Transform: https://www.vertica.com/blog/extending-vertica-with-python-functions-adding-numpy-fft-as-a-udx/

R client

Be sure to obtain and install the R package that matches your Vertica installation from the customer download site.

Vertica doesn't include graphical tools so a front end like RStudio is necessary to show graphs. Or, the output can be stored in a table and viewed with any BI tool that supports ODBC or JDBC.

Python UDx is documented at https://www.vertica.com/docs/9.3.x/HTML/Content/Authoring/ExtendingVertica/UDx/DevelopingUDxs.htm

  • The documentation is largely the same regardless of exact Vertica version.
  • Vertica 9.x ships uses R version 3.5.0 installed at /opt/vertica/R/bin/R

There are several examples in the Vertica installation under /opt/vertica/sdk/examples/

  • The SQL file RFunctions.sql shows how to install and run the R UDx examples
Sign In or Register to comment.