hooks.get_cursor

hooks.get_cursor allows users to retrieve the database cursor associated with their connection. 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):
    with cursor as hooks.get_cursor(adapter_name="<ADAPTER_NAME">):
        cursor.execute("...")
    cursor.close()
    return ...

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

Last updated