Datasets
To analyze data from a data source, files must be formatted into tables in Dremio Sonar. You can then create views from one or more tables. The following figure shows how data is represented in Sonar:
Tables
A table contains the data from your source, formatted as rows and columns. A table is represented by the icon.
Apache Iceberg tables are represented by the icon. Tables in Arctic catalogs use the Iceberg table format by default.
You can use Dremio Sonar to load data into and make changes to Iceberg tables with commands like INSERT
, UPDATE
, DELETE
, and MERGE
. For more information on how Dremio Sonar works with Iceberg, go to Apache Iceberg.
Formatting a Table
See formatting tables and views for more information on how to format a file or folder as a table.
Removing Formatting on a Table
Removing the formatting on a table will revert the table to the folder or file format that it was originally in. For the steps, see Removing Formatting on Data.
Maximum Number of Leaf Columns in a Table
The term leaf columns refers to all columns in a table and all leaf-level fields that are used in complex data types in the table. Tables in Dremio are allowed a maximum of 6,400 leaf columns. For example, if a table has 1,000 columns and the data type of one column is a STRUCT that has three fields, the count of leaf columns is 1,003.
Maximum Number of Leaf Columns Scanned Per Table in a Query
The maximum number of leaf columns that a query is allowed to scan per table or per reflection is 800. If a query attempts to scan more than this limit, then you receive this error message:
At most, <limit> columns including leaf level fields of complex type are allowed to be scanned, but the query is scanning <number>. Please include the columns you want to be returned from the query and try again.
If you are trying to use a SELECT *
query to view all columns in a table, you can avoid scanning too many columns by using the DESCRIBE TABLE
command, which returns the name and other details about all columns in the table.
Retrieving a Table Definition
Only for Arctic tables, you can retrieve the table definition, and in order to retrieve, you will need the SELECT
privilege on the table. Because tables cannot be modified, you can't make edits to the table definition but you can retrieve the definition to understand where the table was derived from and to use it as a template for creating new views.
To see a table definition on the Datasets page, choose any one of these options:
-
Hover over the table name and click in the top right corner of the metadata card.
-
Hover over the line containing the table and click on the right.
-
Hover over the line containing the dataset, click on the right, and select Go to Table.
The table definition opens in the SQL editor.
If you want to use this table definition to create a view, see Creating a View.
If you have the SELECT
privilege on an Arctic table, you can run SHOW CREATE TABLE <table_name>
in the SQL editor to see the table definition. See SHOW CREATE TABLE.
Views
A view is a virtual table based on the result set of a query. Views do not contain any data. You can create views from data that resides in any data source, folder, table, or view that you have access to.
Views stored in Arctic catalogs leverage the Iceberg view specification. Iceberg views are represented by the icon.
Creating a View
You can create a view from an existing table or view. Create a view from a table by performing the following steps:
- Compose the query as required and click Run to validate the query. After running the query, click the arrow next to Save Script As in the top right of the SQL editor, and select Save View as... from the drop-down menu.
- Clicking Save View as... prompts you to name the new view and select from a list of folders where it will be stored. Provide a name and select a folder to store it in.
- To see the new view, use the Datasets page to navigate to the folder where you saved the view, then click the view to see the data.
Example: Creating a View
This example shows how to create a view from the SF weather 2018-2019.csv table by performing the following steps:
-
On the Datasets page, trace the SF weather 2018-2019.csv table in the corresponding source folder and click it. To create a view, change the data type of the ELEVATION into number by running the following query.
Query to change ELEVATION data typeSELECT TO_NUMBER(ELEVATION, '##.##') AS ELEVATION FROM "SF weather 2018-2019.csv"
-
Click the arrow next to Save Script As in the top right of the SQL editor, and select Save View as... from the drop-down menu.
-
Clicking Save View as... prompts you to name the new view and select from a list of folders where it will be stored. Provide a name and select a folder to store it in. Name the view SFWeatherElevation.
-
On the Datasets page, navigate to the folder that contains the SFWeatherElevation view. Click the view to see the query and data. You can see the table with a single Elevation column and the following query.
Query for SFWeatherElevationSELECT * FROM SFWeatherElevation
Retrieving a View Definition
If you have the SELECT
privilege for a view, you can see the underlying definition in the SQL editor but cannot edit the view directly.
To see a view definition on the Datasets page, choose any one of these options:
-
Hover over the view name and click in the top right corner of the metadata card.
-
Hover over the line containing the view and click on the right.
-
Hover over the line containing the view, click on the right, and select Go to Dataset.
The view definition opens in the SQL editor.
If you want to use this definition to create another view, see Creating a View.
If you have the required privileges, you can run SHOW CREATE VIEW <view_name>
in the SQL editor to see the view definition. See SHOW CREATE VIEW.
Editing a View
If you have the privileges required to edit a view, you can see and edit the definition of the view.
To edit a view, complete the following steps:
-
On the Datasets page, choose any one of these options:
-
Hover over the view name and click in the top right corner of the metadata card.
-
Hover over the line containing the view and click on the right.
-
Hover over the line containing the view, click on the right, and select Edit.
-
The view definition opens in the SQL editor.
-
In the SQL editor, make changes to the view definition.
-
Click Save View in the top right corner of the SQL editor.
Removing a View
Perform the following steps to remove a view:
- Use the Datasets page to navigate to the folder where your view is located.
- Hover over the view and click that appears next to the view.
- From the list of actions, click Remove.
- Confirm that you want to remove the view.
If you are removing a table or view with children, you get a warning. Removing a table or view with children leaves you with disconnected views that you can no longer query.
Dataset Metadata Card
Each dataset has a metadata card that contains details about the dataset. To view the metadata card, hover over a dataset in the Datasets page. The components of the metadata card are described below:
Location | Description |
---|---|
1 | Icon represents the dataset format as a table or a view . |
2 | Card title displays the dataset name. |
3 | will appear if the dataset has a reflection. |
4 | Click to query the dataset. |
5 | Click either to edit or to view the dataset. The option that you see depends on your dataset privileges. |
6 | The path where the dataset is located. |
7 | The Arctic branch reference for the context. |
8 | The date and time when the dataset was last updated. |
9 | Launch a BI tool to analyze your data. |
10 | Details Panel: Click this link to open the dataset details panel on the right side of the browser window. In the details panel, you can add or remove labels on the dataset and add or modify wiki content. |
11 | Columns: The number of columns in the dataset, including the name and data type of each column. Columns with partitions (if any) use a separate partition icon. |
- For datasets that are not on the main branch, the metadata does not include BI tools, labels, and wiki content.
- When viewing a metadata card in the SQL Runner's data panel, the Columns section at the bottom of the card is not displayed because columns can be displayed by expanding the dataset.
Wikis and Labels
You can build upon datasets using wikis and labels to enhance discoverability and understanding of the data across your organization. You can use the wiki to provide a description of the dataset or content that helps users get started with the data, such as examples, usage notes, or points of contact for questions or issues. Wikis support Markdown for formatting.
You can also add labels to datasets to easily categorize and help business users identify relevant data. For example, you can add a PII
label to a dataset to indicate that it contains personally identifiable information.