DatabasesOperations Class

DatabasesOperations operations.

You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute.

Inheritance
builtins.object
DatabasesOperations

Constructor

DatabasesOperations(client, config, serializer, deserializer)

Parameters

client
Required

Client for service requests.

config
Required

Configuration of service client.

serializer
Required

An object model serializer.

deserializer
Required

An object model deserializer.

Variables

models

Alias to model classes used in this operation group.

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.

begin_create_or_update(resource_group_name: str, server_name: str, database_name: str, parameters: _models.Database, **kwargs: Any) -> LROPoller[_models.Database]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database.

parameters
Database
Required

The requested database resource state.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

begin_delete

Deletes the database.

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

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

begin_export

Exports a database.

begin_export(resource_group_name: str, server_name: str, database_name: str, parameters: _models.ExportDatabaseDefinition, **kwargs: Any) -> LROPoller[_models.ImportExportOperationResult]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database.

parameters
ExportDatabaseDefinition
Required

The database export request parameters.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

begin_failover

Failovers a database.

begin_failover(resource_group_name: str, server_name: str, database_name: str, replica_type: Optional[Union[str, _models.ReplicaType]] = None, **kwargs: Any) -> LROPoller[None]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database to failover.

replica_type
str or ReplicaType
default value: None

The type of replica to be failed over.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

begin_import_method

Imports a bacpac into a new database.

begin_import_method(resource_group_name: str, server_name: str, database_name: str, parameters: _models.ImportExistingDatabaseDefinition, **kwargs: Any) -> LROPoller[_models.ImportExportOperationResult]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database.

parameters
ImportExistingDatabaseDefinition
Required

The database import request parameters.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

begin_pause

Pauses a database.

begin_pause(resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> LROPoller[_models.Database]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database to be paused.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

begin_resume

Resumes a database.

begin_resume(resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> LROPoller[_models.Database]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database to be resumed.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

begin_update

Updates an existing database.

begin_update(resource_group_name: str, server_name: str, database_name: str, parameters: _models.DatabaseUpdate, **kwargs: Any) -> LROPoller[_models.Database]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database.

parameters
DatabaseUpdate
Required

The requested database resource state.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

begin_upgrade_data_warehouse

Upgrades a data warehouse.

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

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database to be upgraded.

cls
callable

A custom type or function that will be passed the direct response

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

By default, your polling method will be ARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Returns

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

Return type

Exceptions

get

Gets a database.

get(resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> _models.Database

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database.

cls
callable

A custom type or function that will be passed the direct response

Returns

Database, or the result of cls(response)

Return type

Exceptions

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) -> Iterable[_models.DatabaseListResult]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

elastic_pool_name
str
Required

The name of the elastic pool.

cls
callable

A custom type or function that will be passed the direct response

Returns

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

Return type

Exceptions

list_by_server

Gets a list of databases.

list_by_server(resource_group_name: str, server_name: str, skip_token: Optional[str] = None, **kwargs: Any) -> Iterable[_models.DatabaseListResult]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

skip_token
str
default value: None
cls
callable

A custom type or function that will be passed the direct response

Returns

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

Return type

Exceptions

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) -> Iterable[_models.DatabaseListResult]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

cls
callable

A custom type or function that will be passed the direct response

Returns

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

Return type

Exceptions

list_metric_definitions

Returns database metric definitions.

list_metric_definitions(resource_group_name: str, server_name: str, database_name: str, **kwargs: Any) -> Iterable[_models.MetricDefinitionListResult]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database.

cls
callable

A custom type or function that will be passed the direct response

Returns

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

Return type

Exceptions

list_metrics

Returns database metrics.

list_metrics(resource_group_name: str, server_name: str, database_name: str, filter: str, **kwargs: Any) -> Iterable[_models.MetricListResult]

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database.

filter
str
Required

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

cls
callable

A custom type or function that will be passed the direct response

Returns

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

Return type

Exceptions

rename

Renames a database.

rename(resource_group_name: str, server_name: str, database_name: str, parameters: _models.ResourceMoveDefinition, **kwargs: Any) -> None

Parameters

resource_group_name
str
Required

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

server_name
str
Required

The name of the server.

database_name
str
Required

The name of the database to rename.

parameters
ResourceMoveDefinition
Required

The resource move definition for renaming this database.

cls
callable

A custom type or function that will be passed the direct response

Returns

None, or the result of cls(response)

Return type

Exceptions

Attributes

models

models = <module 'azure.mgmt.sql.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.9.13\\x64\\lib\\site-packages\\azure\\mgmt\\sql\\models\\__init__.py'>