# Connection Modes

In the "Connect to Data" dialog, Telmai offers several connection modes for SQL-based sources such as [BigQuery](https://docs.telm.ai/telmai/connect-to-data/data-connections/google-bigquery), [Redshift](https://docs.telm.ai/telmai/connect-to-data/data-connections/aws-redshift), [Snowflake](https://docs.telm.ai/telmai/connect-to-data/data-connections/snowflake), and others.

<figure><img src="https://604868671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkO3-a8YVu1iq1jP__S%2Fuploads%2F7kHYXoK1jiHUFR5zCbU4%2Fimage.png?alt=media&#x26;token=7e48ed2d-b55f-4c0c-9bf0-da0aaa658d75" alt=""><figcaption></figcaption></figure>

It can either connect to an existing table/view or allow you to define an SQL query and analyze the output.

### Connect to existing Table/View <a href="#connect-to-existing-table-view" id="connect-to-existing-table-view"></a>

Select the **“Existing Table“** radio button, and pick an option in the “Create“ dropdown:

* **Single Source:** Configure scans individually with custom schedules and settings, including metadata vs. deep scans.
* **New Group:** Scan multiple tables together for efficiency, using the same Spark cluster and optimized algorithms. However, group sources share the same schedule and scan settings, including metadata vs. deep scan configurations.

#### Single Source Connection <a href="#single-source-connection" id="single-source-connection"></a>

Select **Single Source** and click **Next**.<br>

<figure><img src="https://604868671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkO3-a8YVu1iq1jP__S%2Fuploads%2Fzf1NtTLWhBPuwOgK57cP%2Fimage.png?alt=media&#x26;token=fdf1ef23-1230-4ccd-aa38-c97465775584" alt="" width="563"><figcaption></figcaption></figure>

Choose the table you want to connect to. You can keep the default name or rename the data source as needed.

<figure><img src="https://604868671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkO3-a8YVu1iq1jP__S%2Fuploads%2F9ap3Ul2LwzUA9HAF1fe1%2Fimage.png?alt=media&#x26;token=0387dc9b-e3e2-4dc9-acdb-2906f930418e" alt=""><figcaption></figcaption></figure>

#### New Group Source Connection <a href="#group-source-connection" id="group-source-connection"></a>

Grouping datasets allows you to connect to multiple tables at once, simplifying configuration:

1. Reuse same credential to simplify configuration
2. Enable a shared scan schedule and settings.
3. Optimize scanning for increased throughput, although metadata vs. deep scan settings will apply uniformly across the group.

Select **New Group**, name it, and click **Next**.

<figure><img src="https://604868671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkO3-a8YVu1iq1jP__S%2Fuploads%2FSVwrujHDEyLPjpF2Yeqp%2Fimage.png?alt=media&#x26;token=aeea2cf2-3af6-4e14-bcf3-41e6c90a2298" alt="" width="563"><figcaption></figcaption></figure>

Choose tables/views from the same schema/dataset/collection. You can rename the Telmai data source names if desired. Click **Create** to complete the setup.

<figure><img src="https://604868671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkO3-a8YVu1iq1jP__S%2Fuploads%2FF72wpaq9coW2ZIFTuYzR%2Fimage.png?alt=media&#x26;token=5ac03db5-0253-4a78-b222-7479a3e1b888" alt=""><figcaption></figcaption></figure>

Once the Group Source is created, you can now edit properties of the group or individual properties of each data source:

<figure><img src="https://604868671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkO3-a8YVu1iq1jP__S%2Fuploads%2FHOPBNy0xXA6v0v6ppJZ5%2Fimage.png?alt=media&#x26;token=5351d286-a55c-4f8d-bddd-0da3bcdfe0fb" alt="" width="494"><figcaption></figcaption></figure>

### Query Based Connection <a href="#query-based-connection" id="query-based-connection"></a>

Instead of connecting to an existing table or view, you can define a data source using an SQL query. This is useful for applying transformations or joining multiple tables to monitor the output.

1. **Select “Custom Query”** as the connection mode.<br>

   <figure><img src="https://604868671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkO3-a8YVu1iq1jP__S%2Fuploads%2Ffsow8EpvfO6ZsnXJcwr0%2Fimage.png?alt=media&#x26;token=c4dada3a-fcca-4a51-bcb6-680375e879cb" alt="" width="563"><figcaption></figcaption></figure>
2. Click **Next**, input your query, and click **Validate Query** to ensure it’s correct. Once validated, click **Connect**.<br>

   <figure><img src="https://604868671-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkO3-a8YVu1iq1jP__S%2Fuploads%2FouCUPQLRIUk7WAoxBHup%2Fimage.png?alt=media&#x26;token=84db37cf-f040-456e-9300-f841f14618b9" alt=""><figcaption></figcaption></figure>

A query-based data source functions like any other integration, allowing you to schedule scans, monitor drifts, and apply rules. Note: This option is currently available only for SQL databases like BigQuery, Databricks Delta, etc.

**Best Practices:**

1. **SQL Syntax**: The SQL syntax depends on the underlying system. The queries are pushed to the database. Always refer to the specific database syntax for functions, operators, etc, to ensure they are supported
2. **Full Table/View Names**:Use the full name (e.g., `schema.table`, `project.dataset.table`, `database.schema.table`, or `catalog.database.table`) for all tables in the query
3. **Permissions**: Ensure the service account has permissions for all tables/views used in the query
4. **Named Projections**: Use named projections (e.g., `SELECT column1 + column2 AS total FROM table1`) to capture the schema of the results correctly.
5. **Time Zone**: All queries are executed in the UTC time zone, so adjust any time/date manipulations accordingly.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.telm.ai/telmai/connect-to-data/connection-modes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
