Skip to content

CustomFunction  #798

Open
Open
@T828367-SPARK

Description

@T828367-SPARK

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions