For the complete documentation index, see llms.txt. This page is also available as Markdown.

Make your own Transform

Rasgo uses the Jinja2 templating engine and SQL in transform templates.

1. Create your own Transform template

template = """
SELECT {{ group_by | join(', ') }},
listagg({{ 'distinct ' if distinct else ''}} {{agg_column}}, '{{sep}}')
WITHIN group (order by {{agg_column}} {{order}}) as {{agg_column}}_listagg
FROM {{ source_table }}
GROUP BY {{ group_by | join(', ') }}
"""

{{ source_table }} is a required argument in every template, and Rasgo's API will always compile it to the fully-qualified table name (FQTN) of the dataset that the transform is called on.

2. Publish your Transform template

# Create a new user-defined transform
new_transform = rasgo.create.transform(name="aggregate_string",
                                       source_code=template)

Last updated