Read Another Datastore¶
In Source SQL, a query can read the tables of other datastores that share the workspace datastore's connection. You name each of their tables with a prefix, and the +N control writes that prefix for you.
Related
- Concept: SQL Modes for what Source SQL can read.
- Switch the SQL Mode if the workspace runs Spark SQL, which reads only its own datastore.
Permission Required
The +N list shows only the datastores where you have the Author team permission or higher. To run the query, you need the Author team permission or higher on every datastore it reads. Users with the Admin role can run queries on any datastore.
Prefix rules¶
Tables of the workspace's own datastore need no prefix. Tables of another datastore on the same connection take its location in front of the table name:
| Engine | Prefix | Example |
|---|---|---|
| Athena, BigQuery, Databricks, Dremio, Fabric, Hive, MariaDB, MySQL, Presto, Redshift, Snowflake, SQL Server, Teradata, Trino | database.schema. |
sales.crm.customers |
| Every other engine | schema. |
crm.customers |
When the database and the schema have the same name, as on MySQL and MariaDB, the prefix holds the name once. A query can read only tables that Qualytics has synced.
Steps¶
Step 1: Open a workspace that runs Source SQL.
Step 2: Place the cursor in the SQL where the table name goes.
Step 3: Click +N next to the datastore button, where N is how many other datastores share the connection. The Datastores that share the same connection menu lists each one with its database and schema.
Step 4: Click the datastore to read. Its prefix, such as crm., is written at the cursor. You can also drag the datastore from the menu into your SQL.
Step 5: Type the table name after the prefix. For example:
Step 6: Click Run .
After the run, the Read from chip in the results bar shows each datastore the query read.
Source SQL only
The +N control shows only in Source SQL, and only when other datastores share the connection.