Skip to main content
Question

Unable to find vertica_sdk

  • May 8, 2024
  • 5 replies
  • 6 views

prad33p2301
Forum|alt.badge.img+1

I am trying to write a custom UD Filter in Python as in the below screenshot

But I am unable to find the vertica_sdk module, how can I fix this

5 replies

marcothesane
Forum|alt.badge.img+1
  • Participating Frequently
  • May 8, 2024

There is no such thing as a ready-made sdk module . There is, however, a software development kit, with plugin locations in Vertica's software.

And there are examples that you inspire yourself on when you build your own custom functionality.

For Python, on any Vertica node, go:

$ ls -lF /opt/vertica/sdk/examples/python
total 36
-rw-rw-r-- 1 gessnerm gessnerm  3704 Dez 20 15:32 AvgMultiPhaseUDT.py
-rw-rw-r-- 1 gessnerm gessnerm 11150 Dez 20 15:32 InvertedIndex.py
-rw-rw-r-- 1 gessnerm gessnerm  6931 Dez 20 15:32 ScalarFunctions.py
-rw-rw-r-- 1 gessnerm gessnerm  6206 Dez 20 15:32 TransformFunctions.py
-rw-rw-r-- 1 gessnerm gessnerm  2421 Dez 20 15:32 UDParsers.py

There's no sample on UDFilter, true, but there is one on UDParsers; you could start from that one to build your custom UDFilter Python script


prad33p2301
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • May 9, 2024

Thanks @marcothesane .
All the py samples seems to be inheriting some class from vertica_sdk, are you saying these are just examples and doesnt work?

Also in case of UDFilter the documentation says the subclass should override and provide implementation for process() method

and I am using UDFilter I also need to subclass FilterFactory class

examples in the documentations also suggest importing vertica_sdk


SruthiA
Forum|alt.badge.img+1
  • Participating Frequently
  • May 9, 2024

Did you perform the steps in the below link? vertica_sdk should be available after you set up environment as shown in the below link.

https://docs.vertica.com/24.2.x/en/extending/developing-udxs/developing-with-sdk/python-sdk/setting-up-python-development-environment


prad33p2301
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • May 14, 2024

I have created the virtual env but still see an error which says modulenot found

In my PyUXD I am trying to use a lz4 module which helps me with decompressing the file , but I get only a error saying modulenotfound

PyUDX

**Creating library :- **

CREATE OR REPLACE LIBRARY UDFilterTest AS '/usr/pyudx/UDFilter.py' DEPENDS '/usr/pyudx/lib64/python3.9/site-packages/*' LANGUAGE 'Python';

error :-


SruthiA
Forum|alt.badge.img+1
  • Participating Frequently
  • May 14, 2024

I see that now the error is different. Did you install lz4 module using pip install lz4 on the server?