Query SQL Tables in the TDP
The SQL Search page allows you to query SQL tables in the Tetra Scientific Data and AI Cloud to access your Tetra Data.
NOTE
If you're taking part in the Data Lakehouse Architecture early adopter program (EAP), you can also use the SQL Search page to query Lakehouse tables (Delta Tables), including the Tetra Data Platform (TDP) system table database.
From the SQL SQL Search page, you can do any of the following:
- Filter the list of available SQL tables
- View the SQL table structure and definitions
- View the first 100 rows of content
- Generate custom queries
- Export query results to a CSV file
NOTE
(For customer hosted deployments only) Using the SQL Search page will result in additional costs in your AWS account, because the page runs Amazon Athena queries. Query costs depend on the amount of data stored in your environment. For more information, see Amazon Athena Pricing in the AWS documentation.
Access the SQL Search Page
- Sign in to the TDP.
- In the left navigation menu, choose SQL Search. The SQL Search page appears.
Filter the List of Available SQL Tables
To filter the list of available SQL tables on the SQL Search page, do the following:
- In the Database drop-down, select a database to query.
NOTE
If you're taking part in the Data Lakehouse Architecture (EAP), you can select Amazon Athena databases or Data Lakehouse databases, including the TDP system table database.
- In the Search for Table search bar, enter the name (or a part of the name) of the table that you're looking for.
IMPORTANT
Amazon Athena SQL table names use the
{ORG_SLUG}.table_name
format. Lakehouse table (Delta Table) names use the{ORG_SLUG}__tss__default.table_name
format.
New File Version Behavior
When you process a file using a protocol or Tetraflow, the file’s data resides in that artifact's tables. If you later process the same file or an updated version of the file using a new artifact, that file’s data is stored in the new artifact's tables, leaving the original tables untouched. The Tetra Data Platform (TDP) does not delete the original files’ data from the original tables.
View the Table Structure and Definitions
To view the structure of a table, do the following:
- On the SQL Search page, find the SQL table that you want to review.
- Select the hamburger menu icon next to the table name. A menu appears.
- Choose View Table Info. The Table Definition dialog appears.
Table Definition Information
Each Table Definition includes the following information:
- Table name and time when table was created, last updated, and last accessed
- Names of table columns and their data types
- Parameters (such as the type of file or classification) and whether it contains encrypted data
View the First 100 Rows in the Table
To view the first 100 rows in a table, do the following:
- On the SQL Search page, find the SQL table that you want to review.
- Select the hamburger menu icon next to the table name. A menu appears.
- Choose SELECT First 100 Rows. The SQL query automatically generates and runs. Query results display in the Results table below the SQL query editor.
Create Custom Queries
WARNING
To help improve query performance, make sure that you run delete operations in small batches. Deleting a high number of files at once slows down your SQL queries.
To create a custom query:
- Determine which table or tables you want to query. To review information about the SQL table structure and details, see View Athena SQL Tables and Structure.
- Select SQL Search from the list of menu options again to return to the SQL query editor and results page.
- Enter your query in the SQL Query Editor text box. For syntax assistance, select the SQL syntax documentation link above the text box.
- Select the Run query button. If the query is valid, the results display in the Results section. If there is a issue with the query, an error display in the Results section.
NOTE
The Athena SQL number value is A 64-bit signed double-precision floating point number. The range is
4.94065645841246544e-324d
to1.79769313486231570e+308d
, positive or negative.
Export Results to a CSV File
To export SQL query results to a file in CSV format, do the following:
- Run a query on the SQL Query page.
- At the top of the Results section, select the Export as CSV icon (shows as an arrow pointing into a bin). The query results download as a CSV file to your local machine.
Updated 4 months ago