You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function takes in n parameters. With every odd parameter being a string, and every even parameter being a database column.
How do I create a customFunction that types a dynamic number of parameters. While also making every odd parameter a string.
SQL query should come out looking like:
select site ,
object_construct(
'Name', tbl.name,
'Lat', tbl.site_lat,
'Long', tbl.site_long,
) as myObject
from myTable tbl
Is this possible with Pypika's current functionality?
Thanks
The text was updated successfully, but these errors were encountered:
def object_construct(function_name: str, params: list[tuple[str, str]]) -> CustomFunction:
parameters = []
for p in params:
params.append(param[0]) #append the param's name
params.append(param[1]) #append the param's value
return CustomFunction(function_name, parameters)
Hi I am using Pypika with Snowflake and trying to create a custom function for Snowflakes OBJECT_CONSTRUCT function.
Snowflake docs - https://docs.snowflake.com/en/sql-reference/functions/object_construct.
This function takes in n parameters. With every odd parameter being a string, and every even parameter being a database column.
How do I create a customFunction that types a dynamic number of parameters. While also making every odd parameter a string.
SQL query should come out looking like:
select site ,
object_construct(
'Name', tbl.name,
'Lat', tbl.site_lat,
'Long', tbl.site_long,
) as myObject
from myTable tbl
Is this possible with Pypika's current functionality?
Thanks
The text was updated successfully, but these errors were encountered: