Skip to main content
Version: current [25.x]

Dataset SQL Statements

Datasets can be managed using SQL commands.

Managing Views

Creating Views

Syntax
CREATE VIEW <VIEW-PATH> AS <SQL-QUERY>

For example:

Example
CREATE VIEW demo.jobs_view as SELECT * FROM "oracle_e2e".DREMIO.JOBS

Note:
The path of the dataset needs to exist before creation.

Enabling Default Reflections

Dremio administrators enable Default Reflections for each view with the following SQL command:

Syntax
ALTER VIEW <view> SET ENABLE_DEFAULT_REFLECTION = TRUE | FALSE

For example:

Example
ALTER VIEW mytable SET ENABLE_DEFAULT_REFLECTION = TRUE

Replacing Views

Syntax
CREATE OR REPLACE VIEW <VIEW-PATH> AS <SQL-QUERY>

For example:

Example
CREATE OR REPLACE VIEW demo.jobs_view as SELECT * FROM "oracle_e2e".DREMIO.JOBS

Dropping Views

Syntax
DROP VIEW [ IF EXISTS ] <view_name>

Parameters

[ IF EXISTS ] Optional

When included, the command will succeed regardless of whether the view existed. If this clause is not specified, the command will fail if the view to be dropped does not exist.


<view_name> String

The path of the view that you want to drop.

Refreshing Reflections

This command refreshes reflections for a given dataset.

Syntax
ALTER { TABLE | VIEW } <dataset_name>
REFRESH REFLECTIONS

For information about the refresh action performed, see Triggering Refreshes by Using the Reflection API, the Catalog API, or an SQL Command.