Trino Datasource Integration

AgenticBI natively integrates with Trino, enabling you to query and visualize data from multiple data sources through Trino's distributed SQL query engine. Transform and visualize your Trino data using drag & drop visualizations, combine data from multiple sources, and automate your Trino reporting within AgenticBI.

Overview

There are multiple approaches to integrate with your Trino cluster.

Connect AgenticBI to Trino through a direct connection. AgenticBI enables you to issue native Trino SQL queries to one or more catalogs to create your datasets for visualizations, then blend that data with other SQL/NoSQL sources, automate queries, and share dashboards.

UI Based Approach

Connecting

  1. Log into AgenticBI and click on Menu > Data Sources
  2. Click on + New Datasource button
  3. Select Trino from Data Warehouses section
  4. Configure the datasource connection:

    Field Description
    Datasource Name A friendly name for your Trino connection
    Hostname/IP Hostname or IP address of your Trino coordinator
    Port Port number where Trino is listening (default: 8080)
    Catalog The data source catalog to connect to (e.g., tpch, mysql, postgresql)
    Schema The schema within the catalog (optional, but recommended)
    Username Username for authentication (optional)
    Password Password for authentication (optional)
    Properties Additional connection properties (e.g., SSL=true&SSLVerification=NONE)
  5. Click Test Connection to validate your settings

  6. Click Save to save the datasource

Note: Ensure your Trino cluster is accessible from AgenticBI's servers.

Query

Once connected, you can query your Trino data using SQL:

Visual Builder

  1. Navigate to Queries and create a new query
  2. Select your Trino datasource
  3. Use the Visual Builder mode:
    • Select tables from the schema explorer on the left
    • Drag and drop fields to build your query
    • Apply filters, groupings, and joins visually
    • The SQL is generated automatically

Query Editor

  1. Switch to Query Editor mode for direct SQL editing
  2. Write native Trino SQL queries:

```sql -- Query across multiple catalogs SELECT c.custkey, c.name as customer_name, o.orderdate, o.totalprice FROM tpch.sf1.customer c JOIN tpch.sf1.orders o ON c.custkey = o.custkey WHERE o.orderdate > DATE '2024-01-01' ORDER BY o.totalprice DESC LIMIT 100 ```

```sql -- Cross-catalog query SELECT m.user_id, m.username, p.total_orders, p.lastorderdate FROM mysql.users.members m JOIN postgresql.analytics.purchasesummary p ON m.userid = p.customer_id WHERE p.total_orders > 10 ```

AI Assistant Features

  • Generate Query: Describe what you want in natural language, and AI will generate the SQL
  • Explain Query: Get a plain-language explanation of your SQL query
  • Find Issues: AI analyzes your query for potential problems or optimizations
  • Syntax Help: Get help with Trino-specific SQL syntax

Data Execution Strategy

Choose between: - Direct Query: Execute queries in real-time against Trino - Cached Data: Store results for faster dashboard loading

  1. Click Preview to see query results
  2. Click Save Dataset to save for visualization

Advanced Features

Session Properties

Set session properties for query optimization:

```sql SET SESSION distributed_join = true; SET SESSION querymaxmemory = '8GB';

SELECT * FROM largetable JOIN anothertable... ```

Catalog and Schema Navigation

  • Use the schema explorer to browse available catalogs
  • Navigate through schemas and tables
  • View table columns and data types
  • Right-click to generate sample queries

Best Practices

  1. Specify Schema: Always specify a schema for better performance and to avoid scanning all schemas
  2. Use Appropriate Filters: Push down predicates to reduce data transfer
  3. Leverage Trino's Features: Use Trino's distributed processing for complex analytics
  4. Monitor Query Performance: Use Trino's Web UI to monitor query execution

Troubleshooting

Common issues and solutions:

  1. Connection Timeout: Ensure Trino is accessible from AgenticBI's servers
  2. Authentication Failed: Verify username/password and authentication configuration
  3. Catalog Not Found: Check that the catalog exists and is properly configured in Trino
  4. SSL/TLS Errors: Verify SSL settings and certificate configuration

For additional help, see the Trino documentation or contact AgenticBI support.