Skip to main content

Datasource SQL

Overview

The Datasource Selector in AI Studio allows you to connect to pre-configured databases and switch seamlessly between them. Each datasource may have different schemas, SQL dialects, and performance characteristics.


Selecting a Datasource

Accessing the Datasource Selector

The datasource dropdown is located at the top of the AI Studio interface, above the SQL editor tabs.

Source

Choosing a Datasource

  1. Click the datasource dropdown menu
  2. Browse available datasources
  3. Click to select your target database
  4. All subsequent queries will execute against this datasource

Visual Indicator: The currently selected datasource is always visible in the dropdown, ensuring you know which database you're querying.

Source


Example: Working with Trino DataSource

  1. Click the Datasource dropdown.
  2. Select Trino datasource from the list.
  3. The SQL editor and AI assistant will now operate in the context of the Trino database.
  4. Run queries or ask the AI assistant for help with Trino datasource.
  5. Trino queries differ from other databases (e.g., PostgreSQL) due to SQL dialect differences.
  6. The catalog and schema should be mentioned in the queries.
  7. Using Trino, you can query data from multiple sources (e.g., MySQL, PostgreSQL) and even combine them.

Example Query for Trino:

SELECT 
ms.sport_type_name,
ps.description,
ms.long_name AS "sport_league"
FROM mysql.quickstart.sport_league ms
JOIN postgresql.public.sport_type ps
ON ms.sport_type_name = ps.name;

In this example query, we can see that we are querying data from two different databases - MySQL and PostgreSQL using Trino as a datasource.

Trino Engine


Working with Multiple Datasources

Switching Between Datasources

You can change datasources at any time without losing your work in the editor tabs.

When you switch datasources:

  • Existing SQL code in tabs remains unchanged
  • Query execution targets the newly selected datasource
  • AI assistant updates to use the new schema context
  • Previous result sets remain visible

Multi-Tab Workflow

Leverage multiple tabs to work with different datasources simultaneously:

  1. Tab 1: Connect to Production DB, run query
  2. Tab 2: Switch to Staging DB, test modifications
  3. Tab 3: Connect to Analytics DB, create report

Datasource Configuration

Pre-Configured Datasources

Datasources displayed in the dropdown are pre-configured by your DataDios administrator.

Typical datasources include:

  • Production databases
  • Staging/development environments
  • Data warehouses
  • Analytics databases
  • Backup/archive databases

Datasource Metadata

Each datasource may include:

  • Database type (MySQL, PostgreSQL, etc.)

Note: Datasource connection settings are managed at the platform level and not configurable within AI Studio.