Client for interacting with the Databricks Unity Catalog API.
More...
#include <unity_catalog.h>
Client for interacting with the Databricks Unity Catalog API.
Unity Catalog provides a unified governance solution for data and AI assets. This implementation uses Unity Catalog REST API 2.1.
Example usage:
auto catalogs = uc.list_catalogs();
auto catalog = uc.get_catalog("main");
uc.create_catalog(req);
auto schemas = uc.list_schemas("main");
auto tables = uc.list_tables("main", "default");
Client for interacting with the Databricks Unity Catalog API.
Core authentication configuration shared across all Databricks features.
static AuthConfig from_environment(const std::string &profile="DEFAULT")
Load authentication configuration from all available sources.
Configuration for creating a catalog.
std::string comment
User-provided description.
std::string name
Name of the catalog (required)
Definition at line 46 of file unity_catalog.h.
◆ UnityCatalog() [1/3]
| databricks::UnityCatalog::UnityCatalog |
( |
const AuthConfig & |
auth, |
|
|
const std::string & |
api_version = "2.1" |
|
) |
| |
|
explicit |
Construct a Unity Catalog API client.
- Parameters
-
| auth | Authentication configuration with host and token |
| api_version | Unity Catalog API version to use (default: "2.1") |
◆ UnityCatalog() [2/3]
| databricks::UnityCatalog::UnityCatalog |
( |
std::shared_ptr< internal::IHttpClient > |
http_client | ) |
|
|
explicit |
Construct a Unity Catalog API client with dependency injection (for testing)
- Parameters
-
| http_client | Injected HTTP client (use MockHttpClient for unit tests) |
- Note
- This constructor is primarily for testing with mock HTTP clients
◆ ~UnityCatalog()
| databricks::UnityCatalog::~UnityCatalog |
( |
| ) |
|
◆ UnityCatalog() [3/3]
| databricks::UnityCatalog::UnityCatalog |
( |
const UnityCatalog & |
| ) |
|
|
delete |
◆ create_catalog()
Create a new catalog.
- Parameters
-
| request | Configuration for the new catalog |
- Returns
- CatalogInfo object representing the created catalog
- Exceptions
-
| std::runtime_error | if the API request fails |
◆ create_schema()
Create a new schema.
- Parameters
-
| request | Configuration for the new schema |
- Returns
- SchemaInfo object representing the created schema
- Exceptions
-
| std::runtime_error | if the API request fails |
◆ delete_catalog()
| bool databricks::UnityCatalog::delete_catalog |
( |
const std::string & |
catalog_name, |
|
|
bool |
force = false |
|
) |
| |
Delete a catalog.
- Parameters
-
| catalog_name | The name of the catalog to delete |
| force | If true, deletes the catalog even if it's not empty |
- Returns
- true if the operation was successful
- Exceptions
-
| std::runtime_error | if the API request fails |
- Note
- By default, you cannot delete a catalog that contains schemas. Set force=true to delete a catalog and all its contents.
◆ delete_schema()
| bool databricks::UnityCatalog::delete_schema |
( |
const std::string & |
full_name | ) |
|
Delete a schema.
- Parameters
-
| full_name | The full name of the schema to delete (catalog.schema) |
- Returns
- true if the operation was successful
- Exceptions
-
| std::runtime_error | if the API request fails |
- Note
- The schema must be empty (no tables) before deletion
◆ delete_table()
| bool databricks::UnityCatalog::delete_table |
( |
const std::string & |
full_name | ) |
|
Delete a table.
- Parameters
-
| full_name | The full name of the table to delete (catalog.schema.table) |
- Returns
- true if the operation was successful
- Exceptions
-
| std::runtime_error | if the API request fails |
- Note
- For managed tables, this also deletes the underlying data. For external tables, only the metadata is deleted.
◆ get_catalog()
| CatalogInfo databricks::UnityCatalog::get_catalog |
( |
const std::string & |
catalog_name | ) |
|
Get detailed information about a specific catalog.
- Parameters
-
| catalog_name | The name of the catalog |
- Returns
- CatalogInfo object with full details
- Exceptions
-
| std::runtime_error | if the catalog is not found or the API request fails |
◆ get_schema()
| SchemaInfo databricks::UnityCatalog::get_schema |
( |
const std::string & |
full_name | ) |
|
Get detailed information about a specific schema.
- Parameters
-
| full_name | The full name of the schema (catalog.schema) |
- Returns
- SchemaInfo object with full details
- Exceptions
-
| std::runtime_error | if the schema is not found or the API request fails |
◆ get_table()
| TableInfo databricks::UnityCatalog::get_table |
( |
const std::string & |
full_name | ) |
|
Get detailed information about a specific table.
- Parameters
-
| full_name | The full name of the table (catalog.schema.table) |
- Returns
- TableInfo object with full details
- Exceptions
-
| std::runtime_error | if the table is not found or the API request fails |
◆ list_catalogs()
| std::vector< CatalogInfo > databricks::UnityCatalog::list_catalogs |
( |
| ) |
|
List all catalogs in the metastore.
- Returns
- Vector of CatalogInfo objects
- Exceptions
-
| std::runtime_error | if the API request fails |
◆ list_schemas()
| std::vector< SchemaInfo > databricks::UnityCatalog::list_schemas |
( |
const std::string & |
catalog_name | ) |
|
List all schemas in a catalog.
- Parameters
-
| catalog_name | The name of the catalog |
- Returns
- Vector of SchemaInfo objects
- Exceptions
-
| std::runtime_error | if the API request fails |
◆ list_tables()
| std::vector< TableInfo > databricks::UnityCatalog::list_tables |
( |
const std::string & |
catalog_name, |
|
|
const std::string & |
schema_name |
|
) |
| |
List all tables in a schema.
- Parameters
-
| catalog_name | The name of the catalog |
| schema_name | The name of the schema |
- Returns
- Vector of TableInfo objects
- Exceptions
-
| std::runtime_error | if the API request fails |
◆ operator=()
◆ update_catalog()
Update an existing catalog.
- Parameters
-
| request | Configuration for updating the catalog |
- Returns
- CatalogInfo object representing the updated catalog
- Exceptions
-
| std::runtime_error | if the API request fails |
◆ update_schema()
Update an existing schema.
- Parameters
-
| request | Configuration for updating the schema |
- Returns
- SchemaInfo object representing the updated schema
- Exceptions
-
| std::runtime_error | if the API request fails |
The documentation for this class was generated from the following file: