w.database: Database Instances¶
- class databricks.sdk.service.database.DatabaseAPI¶
Database Instances provide access to a database via REST API or direct SQL.
- create_database_catalog(catalog: DatabaseCatalog) DatabaseCatalog¶
Create a Database Catalog.
- Parameters:
catalog –
DatabaseCatalog- Returns:
- create_database_instance(database_instance: DatabaseInstance) Wait[DatabaseInstance]¶
Create a Database Instance.
- Parameters:
database_instance –
DatabaseInstanceInstance to create.- Returns:
Long-running operation waiter for
DatabaseInstance. See :method:wait_get_database_instance_database_available for more details.
- create_database_instance_and_wait(database_instance: DatabaseInstance, timeout: datetime.timedelta = 0:20:00) DatabaseInstance¶
- create_database_instance_role(instance_name: str, database_instance_role: DatabaseInstanceRole [, database_instance_name: Optional[str]]) DatabaseInstanceRole¶
Create a role for a Database Instance.
- Parameters:
instance_name – str
database_instance_role –
DatabaseInstanceRoledatabase_instance_name – str (optional)
- Returns:
- create_database_table(table: DatabaseTable) DatabaseTable¶
Create a Database Table. Useful for registering pre-existing PG tables in UC. See CreateSyncedDatabaseTable for creating synced tables in PG from a source table in UC.
- Parameters:
table –
DatabaseTable- Returns:
- create_synced_database_table(synced_table: SyncedDatabaseTable) SyncedDatabaseTable¶
Create a Synced Database Table.
- Parameters:
synced_table –
SyncedDatabaseTable- Returns:
- delete_database_catalog(name: str)¶
Delete a Database Catalog.
- Parameters:
name – str
- delete_database_instance(name: str [, force: Optional[bool], purge: Optional[bool]])¶
Delete a Database Instance.
- Parameters:
name – str Name of the instance to delete.
force – bool (optional) By default, a instance cannot be deleted if it has descendant instances created via PITR. If this flag is specified as true, all descendent instances will be deleted as well.
purge – bool (optional) Deprecated. Omitting the field or setting it to true will result in the field being hard deleted. Setting a value of false will throw a bad request.
- delete_database_instance_role(instance_name: str, name: str [, allow_missing: Optional[bool], reassign_owned_to: Optional[str]])¶
Deletes a role for a Database Instance.
- Parameters:
instance_name – str
name – str
allow_missing – bool (optional) This is the AIP standard name for the equivalent of Postgres’ IF EXISTS option
reassign_owned_to – str (optional)
- delete_database_table(name: str)¶
Delete a Database Table.
- Parameters:
name – str
- delete_synced_database_table(name: str [, purge_data: Optional[bool]])¶
Delete a Synced Database Table.
- Parameters:
name – str
purge_data – bool (optional) Optional. When set to true, the actual PostgreSQL table will be dropped from the database.
- find_database_instance_by_uid([, uid: Optional[str]]) DatabaseInstance¶
Find a Database Instance by uid.
- Parameters:
uid – str (optional) UID of the cluster to get.
- Returns:
- generate_database_credential([, claims: Optional[List[RequestedClaims]], instance_names: Optional[List[str]], request_id: Optional[str]]) DatabaseCredential¶
Generates a credential that can be used to access database instances.
- Parameters:
claims – List[
RequestedClaims] (optional) A set of UC permissions to add to the credential. We verify that the caller has the necessary permissions in UC and include a reference in the token. Postgres uses that token to give the connecting user additional grants to the Postgres resources that correspond to the UC resources. The UC resources need to be something that have a Postgres counterpart. For example, a synced table or a table in a UC database catalog.instance_names – List[str] (optional) Instances to request a credential for. At least one of instance_names or claims must be specified.
request_id – str (optional)
- Returns:
- get_database_catalog(name: str) DatabaseCatalog¶
Get a Database Catalog.
- Parameters:
name – str
- Returns:
- get_database_instance(name: str) DatabaseInstance¶
Get a Database Instance.
- Parameters:
name – str Name of the cluster to get.
- Returns:
- get_database_instance_role(instance_name: str, name: str) DatabaseInstanceRole¶
Gets a role for a Database Instance.
- Parameters:
instance_name – str
name – str
- Returns:
- get_database_table(name: str) DatabaseTable¶
Get a Database Table.
- Parameters:
name – str
- Returns:
- get_synced_database_table(name: str) SyncedDatabaseTable¶
Get a Synced Database Table.
- Parameters:
name – str
- Returns:
- list_database_catalogs(instance_name: str [, page_size: Optional[int], page_token: Optional[str]]) Iterator[DatabaseCatalog]¶
This API is currently unimplemented, but exposed for Terraform support.
- Parameters:
instance_name – str Name of the instance to get database catalogs for.
page_size – int (optional) Upper bound for items returned.
page_token – str (optional) Pagination token to go to the next page of synced database tables. Requests first page if absent.
- Returns:
Iterator over
DatabaseCatalog
- list_database_instance_roles(instance_name: str [, page_size: Optional[int], page_token: Optional[str]]) Iterator[DatabaseInstanceRole]¶
START OF PG ROLE APIs Section These APIs are marked a PUBLIC with stage < PUBLIC_PREVIEW. With more recent Lakebase V2 plans, we don’t plan to ever advance these to PUBLIC_PREVIEW. These APIs will remain effectively undocumented/UI-only and we’ll aim for a new public roles API as part of V2 PuPr.
- Parameters:
instance_name – str
page_size – int (optional) Upper bound for items returned.
page_token – str (optional) Pagination token to go to the next page of Database Instances. Requests first page if absent.
- Returns:
Iterator over
DatabaseInstanceRole
- list_database_instances([, page_size: Optional[int], page_token: Optional[str]]) Iterator[DatabaseInstance]¶
List Database Instances.
- Parameters:
page_size – int (optional) Upper bound for items returned. The maximum value is 100.
page_token – str (optional) Pagination token to go to the next page of Database Instances. Requests first page if absent.
- Returns:
Iterator over
DatabaseInstance
- list_synced_database_tables(instance_name: str [, page_size: Optional[int], page_token: Optional[str]]) Iterator[SyncedDatabaseTable]¶
This API is currently unimplemented, but exposed for Terraform support.
- Parameters:
instance_name – str Name of the instance to get synced tables for.
page_size – int (optional) Upper bound for items returned.
page_token – str (optional) Pagination token to go to the next page of synced database tables. Requests first page if absent.
- Returns:
Iterator over
SyncedDatabaseTable
- update_database_catalog(name: str, database_catalog: DatabaseCatalog, update_mask: str) DatabaseCatalog¶
This API is currently unimplemented, but exposed for Terraform support.
- Parameters:
name – str The name of the catalog in UC.
database_catalog –
DatabaseCatalogNote that updating a database catalog is not yet supported.update_mask – str The list of fields to update. Setting this field is not yet supported.
- Returns:
- update_database_instance(name: str, database_instance: DatabaseInstance, update_mask: str) DatabaseInstance¶
Update a Database Instance.
- Parameters:
name – str The name of the instance. This is the unique identifier for the instance.
database_instance –
DatabaseInstanceupdate_mask – str The list of fields to update. If unspecified, all fields will be updated when possible. To wipe out custom_tags, specify custom_tags in the update_mask with an empty custom_tags map.
- Returns:
- update_synced_database_table(name: str, synced_table: SyncedDatabaseTable, update_mask: str) SyncedDatabaseTable¶
This API is currently unimplemented, but exposed for Terraform support.
- Parameters:
name – str Full three-part (catalog, schema, table) name of the table.
synced_table –
SyncedDatabaseTableNote that updating a synced database table is not yet supported.update_mask – str The list of fields to update. Setting this field is not yet supported.
- Returns:
- wait_get_database_instance_database_available(name: str, timeout: datetime.timedelta = 0:20:00, callback: Optional[Callable[[DatabaseInstance], None]]) DatabaseInstance¶