Manage catalogs, databases, and tables¶
Browse, create, and maintain catalogs, databases, and tables in a target workspace. Manage file storage handles volumes and files.
Prerequisites¶
For common calling rules, first read Prepare to call an API.
Prepare access for the target workspace. You need a target catalog before creating a database and a target database before creating a table. Before starting, use the browse and detail actions below to obtain required resource IDs.
Call sequence¶
Browse accessible catalogs, databases, and tables to decide whether to use an existing hierarchy or create new resources. Save the IDs needed for later operations. Use the relevant read actions to inspect system databases, tables in a database, table overviews, or full paths when needed.
To create a hierarchy, create the catalog first, then create a database in that catalog, and finally create a table in the target database.
To read or verify data, get table information first, then preview or retrieve data as required.
After an update, get the corresponding details to confirm current information. Before truncating or deleting, confirm the target object; query the object or data again afterward to confirm the result.
API operations¶
Browse the resource hierarchy¶
What you need to do |
API operation |
Use it when |
|---|---|---|
Browse catalogs, databases, volumes, and tables |
Select existing resources or before creating new resources. |
|
Query catalogs |
Select a target catalog. |
|
Query catalog details |
Confirm current information for a target catalog. |
|
Query databases |
Select a target database. |
|
Query database details |
Confirm a target database. |
|
Query objects in a database |
Browse volumes, tables, and operators in a database. |
|
View system databases |
Read system databases and their hierarchy. |
|
View tables in a database |
Obtain tables under a specified database. |
Create and maintain catalogs and databases¶
What you need to do |
API operation |
Use it when |
|---|---|---|
Create a catalog |
Create a parent catalog and obtain its ID for later database creation. |
|
Update a catalog |
Modify an existing catalog. |
|
Delete a catalog |
You have handled lower-level objects. |
|
View catalog references |
Check references before changing or deleting a catalog. |
|
Create a database |
You identified the parent catalog. |
|
Update a database |
Modify an existing database. |
|
Delete a database |
You confirmed that the database is not used by a publication or subscription. |
Manage tables and table data¶
What you need to do |
API operation |
Use it when |
|---|---|---|
Check whether a table exists |
Confirm a target table before creating or referencing it. |
|
Create a table |
You identified the target database. |
|
Query table information |
Confirm table definition and current information. |
|
Batch query table information |
Read information for several known tables at once. |
|
View a table overview |
View an aggregated current overview of a table. |
|
View the full table path |
Confirm a table’s full resource-hierarchy path. |
|
Query table data |
Read sampled data from a table. |
|
Preview table data |
Inspect table data first. |
|
Download table data |
Obtain downloaded table data. |
|
Run NL2SQL |
Convert a natural-language request to SQL and run it. |
|
Truncate a table |
Delete all data while retaining the table definition after confirming the target table. |
|
Delete a table |
Delete a table and its data after confirming the target. |
|
Query table references |
Check references before changing or deleting a table. |
Confirm the result¶
After creation or an update, get details for the corresponding catalog, database, or table to confirm the object used for later operations. Preview or sample-query data before reading it. After truncation, query table data again to confirm that content is cleared; after deletion, use the hierarchy or object list to confirm that the target no longer appears.
Limitations and notes¶
Deleting a catalog is irreversible; handle lower-level objects first.
Before deleting a database, confirm it is not used by a publication or subscription.
Truncating a table removes all data while retaining its definition and is irreversible. Deleting a table removes the table and its data.
A table-data query returns 100 rows by default when no explicit row count is supplied.