hooks.get_connection

hooks.get_connection allows users to retrieve the Connection associated with your database session. This allows you to execute far more flexible SQL code within your tasks.

# tasks/sql_task.py

# Imports
from prism.decorators import task


# Task
@task()
def sql_task(tasks, hooks):
    conn = hooks.get_connection(adapter_name="<ADAPTER_NAME">)
    conn.do_stuff()
    return ...

Consult the API reference for details on the technical specifications of hooks.get_connection.

Last updated