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 Make your first AI Studio API call.
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¶
Task |
Use it when |
|---|---|
Submit SQL execution. |
|
Check current execution status after submission. |
|
Read results after they become available. |
|
Obtain an execution-result file. |
|
The target execution no longer needs to continue. |
Query SQL metadata¶
Task |
Use it when |
|---|---|
Select a target database. |
|
Locate a table in a selected database. |
|
Inspect current information for one table. |
|
View table fields. |
|
View a table-definition statement. |
Delete metadata objects¶
Task |
Use it when |
|---|---|
You confirmed that the database is no longer needed. |
|
You confirmed that the table is no longer needed. |
|
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.