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

  1. To understand existing objects, query databases, tables in a database, table information, table fields, or table-creation statements.

  2. After submitting SQL execution, retain the execution ID and query execution status.

  3. Query or download results after they become available. Cancel an execution when it no longer needs to continue.

  4. 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

Execute SQL

Submit SQL execution.

Query execution status

Get execution status

Check current execution status after submission.

Query execution results

Get execution result

Read results after they become available.

Download execution results

Download execution result

Obtain an execution-result file.

Cancel an execution

Cancel execution

The target execution no longer needs to continue.

Query SQL metadata

What you need to do

API operation

Use it when

Query databases

List databases

Select a target database.

Query tables in a database

List tables and views in a database

Locate a table in a selected database.

Query table information

Get table information

Inspect current information for one table.

View table fields

List table columns

View table fields.

Query a creation statement

Get a table or view DDL

View a table-definition statement.

Delete metadata objects

What you need to do

API operation

Use it when

Delete a database

Delete a database

You confirmed that the database is no longer needed.

Delete a table

Delete a table

You confirmed that the table is no longer needed.

Delete a view

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.

Next steps

Last updated on