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

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