Does anyone know how to create table-valued function in Vertica SQL?
For example, I want to create a function
f_student_name()
that takes in input: student_id
to return output: student_name
in a query, extracting directly from a students
table, where student_id, student_name
are unique 1:1 mapped.
Use case: not having to constantly join on the same table for a lot of queries, improving readability and reducing spaghetti code.
I can't seem to find any documentation on this. Function documentation in Vertica only gives examples of creating functions by hardcoding (CASE x when ... then ... )
I would like to build this table-valued function using VSQL, but an optimal solution using Python (and have the function work in Vertica) would also work.