[Yandex Cloud documentation](../../../index.md) > [Yandex DataLens](../../index.md) > Connections > Files and services > Creating a Yandex Query connection

# Creating a Yandex Query connection

{% note info %}

To create a connection, you need a [service account](../../../iam/concepts/users/service-accounts.md) with the `yq.editor` or `editor` [role](../../../iam/operations/sa/assign-role-for-sa.md) for the folder with your Yandex Query [connection](../../../query/concepts/glossary.md#connection).

{% endnote %}

To create a Yandex Query connection:

1. Open the [connection creation page](https://datalens.ru/connections/new).
1. Under **Files and services**, select the **Yandex Query** connection.
1. Configure the connection as follows:

   * **Cloud and folder**: Select the folder with your Yandex Query connection.
   * **Service account**: Select an existing [service account](../../../iam/concepts/users/service-accounts.md) or create a new one.
   * **Cache TTL in seconds**: Specify the cache TTL or leave the default value.
   * **Raw SQL level**: Enables you to use an ad-hoc SQL query to [generate a dataset](../../dataset/settings.md#sql-request-in-datatset).

1. Optionally, test the connection by clicking **Check connection**.
1. Click **Create connection**.
1. Select the [workbook](../../workbooks-collections/index.md) to save your connection to or create a new one. If using legacy folder navigation, select a folder to save the connection to. Click **Create**.
1. Enter a name for the connection and click **Create**.


## Use cases {#examples}

* [Visualizing Yandex Object Storage data in Yandex DataLens](../../tutorials/data-from-yandex-query-visualization.md)