Skip to content
Dremio-Specific Engine & Optimizations Last updated: May 29, 2026

Dremio External Queries

Dremio External Queries are SQL pass-through commands that allow users to execute native database queries directly on underlying relational databases, bypassing Dremio planning logic.

dremio external queriespass-through query sqlnative sql executionfederated query bypassdatabase pushdown query

Dremio External Queries

Dremio External Queries are SQL syntax wrappers that enable users to execute native SQL queries directly on underlying relational database sources. Normally, Dremio compiles incoming SQL queries into an optimized logical execution plan, translates that plan into the source dialect, and pushes operations down dynamically.

However, some queries require vendor-specific SQL syntax, proprietary functions, or optimization hints that are not natively supported by standard Dremio SQL syntax. External Queries provide a pass-through mechanism to run queries directly on target sources (such as Snowflake, Oracle, PostgreSQL, and Teradata).

SQL Syntax and Usage

External Queries utilize the external_query table function wrapper. The function takes the target database source name as its container and accepts a single query string argument:

SELECT * FROM table(source_name.external_query(query => 'SELECT * FROM raw_orders WHERE order_date > CURRENT_DATE()'))

During execution:

  1. Parse and Ship: Dremio’s coordinator parses the outer SELECT statement and extracts the SQL query string argument inside external_query.
  2. Remote Execution: Dremio transmits the query string directly to the target source without planning or optimization.
  3. Result Retrieval: The target database executes the query using its own compute engine and streams the output records back to Dremio.
  4. Dremio Processing: Dremio converts the returned streams into Apache Arrow format, allowing the output to be filtered, aggregated, or joined with other datasets (such as Iceberg tables in S3) within the same query.

Key Use Cases

External Queries are valuable in several database federation scenarios:

Security Controls and Governance

Because pass-through queries bypass Dremio’s query planner and compiler, managing security is essential:

📚 Go Deeper on Apache Iceberg

Alex Merced has authored three hands-on books covering Apache Iceberg, the Agentic Lakehouse, and modern data architecture. Pick up a copy to master the full ecosystem.

← Back to Iceberg Knowledge Base