hooks.get_cursor(...)
Function used to retrieve a cursor from an adapter's connection
hooks.get_cursor(
adapter_name: str
)
Parameters
adapter_name
: the adapter in the projects profile YML whose connection you want to retrieve
Returns:
A database cursor associated with the adapter's connection
Note that this is only available for the following adapters:
Postgres
Redshift
Snowflake
Trino
from prism.task import PrismTask
class SqlTask(PrismTask)
def run(self, tasks, hooks):
with cursor as hooks.get_connection(adapter_name="<ADAPTER_NAME">):
cursor.execute("...")
cursor.close()
return ...