# hooks.get\_connection(...)

`hooks.get_connection(`*`adapter_name: str`*`)`

* Parameters
  * `adapter_name`: the adapter in the projects [profile YML](https://docs.runprism.com/v0.2.6/fundamentals/config-files/profile-yml) whose connection you want to retrieve
* Returns:
  * BigQuery --> [`google.cloud.bigquery.Client`](https://gcloud.readthedocs.io/en/latest/bigquery-client.html)
  * Postgres --> [`psycopg2.Connection`](https://www.psycopg.org/docs/connection.html)
  * Redshift --> [`psycopg2.Connection`](https://www.psycopg.org/docs/connection.html)
  * Snowflake --> [`snowflake.connector.Connection`](https://docs.runprism.com/v0.2.6/fundamentals/tasks/tasks)
  * Trino --> [`trino.dbapi.Connection`](https://github.com/trinodb/trino-python-client)

{% tabs %}
{% tab title="Class-based task" %}

```python
from prism.task import PrismTask

class SqlTask(PrismTask)

    def run(self, tasks, hooks):
        conn = hooks.get_connection(adapter_name="<ADAPTER_NAME">)
        conn.do_stuff()
        return ...

```

{% endtab %}

{% tab title="Function-based task" %}

```python
from prism.decorators import task


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

```

{% endtab %}
{% endtabs %}
