Condividi tramite


DatabasesOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

SqlManagementClient's

<xref:databases> attribute.

Constructor

DatabasesOperations(*args, **kwargs)

Methods

begin_create_or_update

Creates a new database or updates an existing database.

begin_delete

Deletes the database.

begin_export

Exports a database.

begin_failover

Failovers a database.

begin_import_method

Imports a bacpac into a new database.

begin_pause

Pauses a database.

begin_resume

Resumes a database.

begin_update

Updates an existing database.

begin_upgrade_data_warehouse

Upgrades a data warehouse.

get

Gets a database.

list_by_elastic_pool

Gets a list of databases in an elastic pool.

list_by_server

Gets a list of databases.

list_inaccessible_by_server

Gets a list of inaccessible databases in a logical server.

list_metric_definitions

Returns database metric definitions.

list_metrics

Returns database metrics.

rename

Renames a database.

begin_create_or_update

Creates a new database or updates an existing database.

async begin_create_or_update(resource_group_name: str, server_name: str, database_name: str, parameters: _models.Database, *, content_type: str = 'application/json', **kwargs: Any) -> AsyncLROPoller[_models.Database]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database. Required.

parameters
Required

The requested database resource state. Is either a Database type or a IO[bytes] type. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either Database or the result of cls(response)

Exceptions

Type Description

begin_delete

Deletes the database.

async begin_delete(resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> AsyncLROPoller[None]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

begin_export

Exports a database.

async begin_export(resource_group_name: str, server_name: str, database_name: str, parameters: _models.ExportDatabaseDefinition, *, content_type: str = 'application/json', **kwargs: Any) -> AsyncLROPoller[_models.ImportExportOperationResult]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database. Required.

parameters
Required

The database export request parameters. Is either a ExportDatabaseDefinition type or a IO[bytes] type. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either ImportExportOperationResult or the result of cls(response)

Exceptions

Type Description

begin_failover

Failovers a database.

async begin_failover(resource_group_name: str, server_name: str, database_name: str, replica_type: str | ReplicaType | None = None, **kwargs: Any) -> AsyncLROPoller[None]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database to failover. Required.

replica_type

The type of replica to be failed over. Known values are: "Primary" and "ReadableSecondary". Default value is None.

Default value: None

Returns

Type Description

An instance of AsyncLROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

begin_import_method

Imports a bacpac into a new database.

async begin_import_method(resource_group_name: str, server_name: str, database_name: str, parameters: _models.ImportExistingDatabaseDefinition, *, content_type: str = 'application/json', **kwargs: Any) -> AsyncLROPoller[_models.ImportExportOperationResult]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database. Required.

parameters
Required

The database import request parameters. Is either a ImportExistingDatabaseDefinition type or a IO[bytes] type. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either ImportExportOperationResult or the result of cls(response)

Exceptions

Type Description

begin_pause

Pauses a database.

async begin_pause(resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> AsyncLROPoller[Database]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database to be paused. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either Database or the result of cls(response)

Exceptions

Type Description

begin_resume

Resumes a database.

async begin_resume(resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> AsyncLROPoller[Database]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database to be resumed. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either Database or the result of cls(response)

Exceptions

Type Description

begin_update

Updates an existing database.

async begin_update(resource_group_name: str, server_name: str, database_name: str, parameters: _models.DatabaseUpdate, *, content_type: str = 'application/json', **kwargs: Any) -> AsyncLROPoller[_models.Database]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database. Required.

parameters
Required

The requested database resource state. Is either a DatabaseUpdate type or a IO[bytes] type. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either Database or the result of cls(response)

Exceptions

Type Description

begin_upgrade_data_warehouse

Upgrades a data warehouse.

async begin_upgrade_data_warehouse(resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> AsyncLROPoller[None]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database to be upgraded. Required.

Returns

Type Description

An instance of AsyncLROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

get

Gets a database.

async get(resource_group_name: str, server_name: str, database_name: str, expand: str | None = None, filter: str | None = None, **kwargs: Any) -> Database

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database. Required.

expand
str

The child resources to include in the response. Default value is None.

Default value: None
filter
str

An OData filter expression that filters elements in the collection. Default value is None.

Default value: None

Returns

Type Description

Database or the result of cls(response)

Exceptions

Type Description

list_by_elastic_pool

Gets a list of databases in an elastic pool.

list_by_elastic_pool(resource_group_name: str, server_name: str, elastic_pool_name: str, **kwargs: Any) -> AsyncItemPaged[Database]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

elastic_pool_name
Required
str

The name of the elastic pool. Required.

Returns

Type Description

An iterator like instance of either Database or the result of cls(response)

Exceptions

Type Description

list_by_server

Gets a list of databases.

list_by_server(resource_group_name: str, server_name: str, skip_token: str | None = None, **kwargs: Any) -> AsyncItemPaged[Database]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

skip_token
str

Default value is None.

Default value: None

Returns

Type Description

An iterator like instance of either Database or the result of cls(response)

Exceptions

Type Description

list_inaccessible_by_server

Gets a list of inaccessible databases in a logical server.

list_inaccessible_by_server(resource_group_name: str, server_name: str, **kwargs: Any) -> AsyncItemPaged[Database]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

Returns

Type Description

An iterator like instance of either Database or the result of cls(response)

Exceptions

Type Description

list_metric_definitions

Returns database metric definitions.

list_metric_definitions(resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> AsyncItemPaged[MetricDefinition]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database. Required.

Returns

Type Description

An iterator like instance of either MetricDefinition or the result of cls(response)

Exceptions

Type Description

list_metrics

Returns database metrics.

list_metrics(resource_group_name: str, server_name: str, database_name: str, filter: str, **kwargs: Any) -> AsyncItemPaged[Metric]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database. Required.

filter
Required
str

An OData filter expression that describes a subset of metrics to return. Required.

Returns

Type Description

An iterator like instance of either Metric or the result of cls(response)

Exceptions

Type Description

rename

Renames a database.

async rename(resource_group_name: str, server_name: str, database_name: str, parameters: _models.ResourceMoveDefinition, *, content_type: str = 'application/json', **kwargs: Any) -> None

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. Required.

server_name
Required
str

The name of the server. Required.

database_name
Required
str

The name of the database to rename. Required.

parameters
Required

The resource move definition for renaming this database. Is either a ResourceMoveDefinition type or a IO[bytes] type. Required.

Returns

Type Description

None or the result of cls(response)

Exceptions

Type Description

Attributes

models

models = <module 'azure.mgmt.sql.models' from 'C:\\ToolCache\\Python\\3.12.10\\x64\\Lib\\site-packages\\py2docfx\\venv\\venv268\\Lib\\site-packages\\azure\\mgmt\\sql\\models\\__init__.py'>