# 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.

```python
# 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](https://docs.runprism.com/v0.2.5/api-reference/prismhooks/hooks.get_cursor-...) for details on the technical specifications of `hooks.get_cursor`.
