Using third party modules like pandas in python udx

Hello everyone,

Although this question has been asked twice earlier but I did not understand procedure of it. Once it remained unanswered and one it was suggested to install pandas in vertica but how?

My question is, if someone wants to create a udx and want to import pandas just like vertica_sdk in python udx then how to achieve that goal. How will vertica understand third parties from inside code?

Answers

  • SruthiASruthiA Vertica Employee Administrator

    First, install python and its corresponding pip module on your vertica node. Now use pip to install required packages. In your case, it is pandas. Create a directory named "dependencies" in the location where your UDx exists. Now copy the pandas and other libraries folders from site-packages folder (it is created, when you install python) to dependencies folder. Now create library with DEPENDS clause and specify the path of dependencies directory

    CREATE LIBRARY myLib AS '/home/dbadmin/myprogram.py'
    DEPENDS '/home/dbadmin/dependencies/*' LANGUAGE 'PYTHON';
    https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/SQLReferenceManual/Statements/CREATELIBRARY.htm

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file