Execute SQL and manage SQL metadata¶
Execute SQL, track execution status and results, and query or delete related database, table, and view metadata. This page does not manage saved SQL or data dashboards; see Manage SQL workbooks and data dashboards for those objects.
Prerequisites¶
Prepare credentials that can access the target workspace and database information for SQL to execute or objects to query. For service endpoints, authentication, and general request formats, see Prepare to call an API.
Before querying or deleting metadata, identify the target object through database and table queries.
Call sequence¶
To understand existing objects, query databases, tables in a database, table information, table fields, or table-creation statements.
After submitting SQL execution, retain the execution ID and query execution status.
Query or download results after they become available. Cancel an execution when it no longer needs to continue.
Before deleting a database, table, or view, confirm the object and impact scope.
API operations¶
Execute SQL and obtain results¶
What you need to do |
API operation |
Use it when |
|---|---|---|
Execute SQL |
Submit SQL execution. |
|
Query execution status |
Check current execution status after submission. |
|
Query execution results |
Read results after they become available. |
|
Download execution results |
Obtain an execution-result file. |
|
Cancel an execution |
The target execution no longer needs to continue. |
Query SQL metadata¶
What you need to do |
API operation |
Use it when |
|---|---|---|
Query databases |
Select a target database. |
|
Query tables in a database |
Locate a table in a selected database. |
|
Query table information |
Inspect current information for one table. |
|
View table fields |
View table fields. |
|
Query a creation statement |
View a table-definition statement. |
Delete metadata objects¶
What you need to do |
API operation |
Use it when |
|---|---|---|
Delete a database |
You confirmed that the database is no longer needed. |
|
Delete a table |
You confirmed that the table is no longer needed. |
|
Delete a view |
You confirmed that the view is no longer needed. |
Confirm the result¶
After submitting SQL, first use Get execution status to confirm progress, then query or download results. Before and after deleting metadata objects, use the relevant database, table, and table-information queries to confirm the target object.
Limitations and notes¶
Submitting SQL does not mean results are available. Use execution status and result queries to confirm.
Before deleting a database, table, or view, confirm impact and conditions on the corresponding action page.