sql

Prism users can execute sql queries using the hooks.sql() function. This function takes three arguments:

  1. adapter_name: the adapter with which to run the SQL query. This should match the adapter name in profile.yml.

  2. query: the SQL query as a string

  3. return_type: the return type for the SQL query. The default value is "pandas" for returning a Pandas DataFrame. Other valid options include:

    • None if you want to create a table, view, schema, database, etc.

def run(self, tasks, hooks):
    hooks.sql(
        adapter_name="...",
        query="...",
        return_type = "pandas"
    )

The configurations for these adapters need to be specified in profile.yml, and they are covered in more detail next.

Last updated