> For the complete documentation index, see [llms.txt](https://docs.telm.ai/telmai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.telm.ai/telmai/connect-to-data/connection-modes.md).

# Connection Modes

Add assets from existing tables and views, or from a SQL query.

When you add assets from a database or warehouse, such as [BigQuery](https://docs.telm.ai/telmai/connect-to-data/data-connections/google-bigquery.md), [Redshift](https://docs.telm.ai/telmai/connect-to-data/data-connections/aws-redshift.md) or [Snowflake](https://docs.telm.ai/telmai/connect-to-data/data-connections/snowflake.md), you choose how Telmai reads the data:

* **Existing table** — monitor tables or views as they are.
* **Custom query** — monitor the result of a SQL query you write.

## The add-asset dialog

Start from **Add assets** on a connection, or **Add asset** on an overview on the Assets page. See [Add assets](https://docs.telm.ai/telmai/connect-to-data.md#list-of-connectors-enabled-by-default). The dialog has three steps:

1. **Select system** — choose the platform. This step is skipped when you start from a connection.
2. **Configure** — the **Project** and the connection under **Select connection** (both already filled in when you start from a connection), where the data lives (for example **Database** and **Schema**), and the **Connection mode**.
3. **Create assets** — choose the tables, or enter the query, and name the new assets.

## Existing table <a href="#connect-to-existing-table-view" id="connect-to-existing-table-view"></a>

1. In the **Configure** step, select **Existing table** and click **Next**.
2. In **Create assets**, type in **Search by table name...** and select the tables or views to monitor, up to 5 in one step.
3. Keep the suggested asset names, or rename them.
4. Click **Create assets**.

Each table becomes its own asset, with its own schedule and scan settings.

{% hint style="info" %}
Existing asset groups, which scan several tables together with one shared schedule and settings, are managed through the group's **⋯** menu in the asset tree, or from the group's overview. See [Managing Assets](https://docs.telm.ai/telmai/connect-to-data/managing-assets.md#overviews).
{% endhint %}

## Custom query <a href="#query-based-connection" id="query-based-connection"></a>

Instead of a table, you can define an asset by a SQL query. Use it to transform data or join tables, then monitor the result.

1. In the **Configure** step, select **Custom query** and click **Next**.
2. Enter the **Asset name** and write the query.
3. Click **Validate query** to check it, then click **Create assets**.

A query-based asset works like any other: you can schedule scans, monitor drifts and apply rules. Custom queries are available for SQL databases and warehouses, such as BigQuery and Databricks.

### Best practices

1. **SQL syntax** — queries run in your database, so use its own syntax for functions and operators.
2. **Full table names** — refer to every table by its full name, for example `schema.table`, `project.dataset.table`, `database.schema.table` or `catalog.database.table`.
3. **Permissions** — make sure the connection's account can read every table and view in the query.
4. **Named columns** — name computed columns, for example `SELECT column1 + column2 AS total FROM table1`, so the result has a clear schema.
5. **Time zone** — queries run in UTC, so adjust any date and time logic accordingly.
6. **Filters** — the **Rows to scan** filter in asset settings isn't available for query-based assets. Filter in the query instead.
