hooks.get_connection(...)
Function used to retrieve adapter's connection class
hooks.get_connection(
adapter_name: str
)
Parameters
adapter_name
: the adapter in the projects profile YML whose connection you want to retrieve
Returns:
BigQuery -->
google.cloud.bigquery.Client
Postgres -->
psycopg2.Connection
Redshift -->
psycopg2.Connection
Snowflake -->
snowflake.connector.Connection
Trino -->
trino.dbapi.Connection
from prism.task import PrismTask
class SqlTask(PrismTask)
def run(self, tasks, hooks):
conn = hooks.get_connection(adapter_name="<ADAPTER_NAME">)
conn.do_stuff()
return ...