SqlDatabaseManagementService Class

Note that this class is a preliminary work on SQL Database management. Since it lack a lot a features, final version can be slightly different from the current one.

Inheritance
azure.servicemanagement.servicemanagementclient._ServiceManagementClient
SqlDatabaseManagementService

Constructor

SqlDatabaseManagementService(subscription_id=None, cert_file=None, host='management.core.windows.net', request_session=None, timeout=65)

Parameters

subscription_id
default value: None
cert_file
default value: None
host
default value: management.core.windows.net
request_session
default value: None
timeout
default value: 65

Methods

create_database

Creates a new Azure SQL Database.

server_name: Name of the server to contain the new database.

name: Required. The name for the new database. See Naming Requirements in Azure SQL Database General Guidelines and Limitations and Database Identifiers for more information.

service_objective_id: Required. The GUID corresponding to the performance level for Edition. See List Service Level Objectives for current values.

edition: Optional. The Service Tier (Edition) for the new database. If omitted, the default is Web. Valid values are Web, Business, Basic, Standard, and Premium. See Azure SQL Database Service Tiers (Editions) and Web and Business Edition Sunset FAQ for more information.

collation_name: Optional. The database collation. This can be any collation supported by SQL. If omitted, the default collation is used. See SQL Server Collation Support in Azure SQL Database General Guidelines and Limitations for more information.

max_size_bytes: Optional. Sets the maximum size, in bytes, for the database. This value must be within the range of allowed values for Edition. If omitted, the default value for the edition is used. See Azure SQL Database Service Tiers (Editions) for current maximum databases sizes. Convert MB or GB values to bytes. 1 MB = 1048576 bytes. 1 GB = 1073741824 bytes.

create_firewall_rule

Creates an Azure SQL Database server firewall rule.

server_name: Name of the server to set the firewall rule on.

name: The name of the new firewall rule.

start_ip_address: The lowest IP address in the range of the server-level firewall setting. IP addresses equal to or greater than this can attempt to connect to the server. The lowest possible IP address is 0.0.0.0.

end_ip_address: The highest IP address in the range of the server-level firewall setting. IP addresses equal to or less than this can attempt to connect to the server. The highest possible IP address is 255.255.255.255.

create_server

Create a new Azure SQL Database server.

admin_login: The administrator login name for the new server.

admin_password: The administrator login password for the new server.

location: The region to deploy the new server.

delete_database

Deletes an Azure SQL Database.

server_name: Name of the server where the database is located.

name: Name of the database to delete.

delete_firewall_rule

Deletes an Azure SQL Database server firewall rule.

server_name: Name of the server with the firewall rule you want to delete.

name: Name of the firewall rule you want to delete.

delete_server

Deletes an Azure SQL Database server (including all its databases).

server_name: Name of the server you want to delete.

get_server_event_logs

Gets the event logs for an Azure SQL Database Server.

server_name: Name of the server to retrieve the event logs from.

start_date: The starting date and time of the events to retrieve in UTC format, for example '2011-09-28 16:05:00'.

interval_size_in_minutes: Size of the event logs to retrieve (in minutes). Valid values are: 5, 60, or 1440.

event_types: The event type of the log entries you want to retrieve. Valid values are:

  * connection_successful 

  * connection_failed 

  * connection_terminated 

  * deadlock 

  * throttling 

  * throttling_long_transaction 

To return all event types pass in an empty string.

list_databases

List the SQL databases defined on the specified server name

list_firewall_rules

Retrieves the set of firewall rules for an Azure SQL Database Server.

server_name: Name of the server.

list_quotas

Gets quotas for an Azure SQL Database Server.

server_name: Name of the server.

list_servers

List the SQL servers defined on the account.

list_service_level_objectives

Gets the service level objectives for an Azure SQL Database server.

server_name: Name of the server.

set_server_admin_password

Reset the administrator password for a server.

server_name: Name of the server to change the password.

admin_password: The new administrator password for the server.

update_database

Updates existing database details.

server_name: Name of the server to contain the new database.

name: Required. The name for the new database. See Naming Requirements in Azure SQL Database General Guidelines and Limitations and Database Identifiers for more information.

new_database_name: Optional. The new name for the new database.

service_objective_id: Optional. The new service level to apply to the database. For more information about service levels, see Azure SQL Database Service Tiers and Performance Levels. Use List Service Level Objectives to get the correct ID for the desired service objective.

edition: Optional. The new edition for the new database.

max_size_bytes: Optional. The new size of the database in bytes. For information on available sizes for each edition, see Azure SQL Database Service Tiers (Editions).

update_firewall_rule

Update a firewall rule for an Azure SQL Database server.

server_name: Name of the server to set the firewall rule on.

name: The name of the firewall rule to update.

start_ip_address: The lowest IP address in the range of the server-level firewall setting. IP addresses equal to or greater than this can attempt to connect to the server. The lowest possible IP address is 0.0.0.0.

end_ip_address: The highest IP address in the range of the server-level firewall setting. IP addresses equal to or less than this can attempt to connect to the server. The highest possible IP address is 255.255.255.255.

create_database

Creates a new Azure SQL Database.

server_name: Name of the server to contain the new database.

name: Required. The name for the new database. See Naming Requirements in Azure SQL Database General Guidelines and Limitations and Database Identifiers for more information.

service_objective_id: Required. The GUID corresponding to the performance level for Edition. See List Service Level Objectives for current values.

edition: Optional. The Service Tier (Edition) for the new database. If omitted, the default is Web. Valid values are Web, Business, Basic, Standard, and Premium. See Azure SQL Database Service Tiers (Editions) and Web and Business Edition Sunset FAQ for more information.

collation_name: Optional. The database collation. This can be any collation supported by SQL. If omitted, the default collation is used. See SQL Server Collation Support in Azure SQL Database General Guidelines and Limitations for more information.

max_size_bytes: Optional. Sets the maximum size, in bytes, for the database. This value must be within the range of allowed values for Edition. If omitted, the default value for the edition is used. See Azure SQL Database Service Tiers (Editions) for current maximum databases sizes. Convert MB or GB values to bytes. 1 MB = 1048576 bytes. 1 GB = 1073741824 bytes.

create_database(server_name, name, service_objective_id, edition=None, collation_name=None, max_size_bytes=None)

Parameters

server_name
Required
name
Required
service_objective_id
Required
edition
default value: None
collation_name
default value: None
max_size_bytes
default value: None

create_firewall_rule

Creates an Azure SQL Database server firewall rule.

server_name: Name of the server to set the firewall rule on.

name: The name of the new firewall rule.

start_ip_address: The lowest IP address in the range of the server-level firewall setting. IP addresses equal to or greater than this can attempt to connect to the server. The lowest possible IP address is 0.0.0.0.

end_ip_address: The highest IP address in the range of the server-level firewall setting. IP addresses equal to or less than this can attempt to connect to the server. The highest possible IP address is 255.255.255.255.

create_firewall_rule(server_name, name, start_ip_address, end_ip_address)

Parameters

server_name
Required
name
Required
start_ip_address
Required
end_ip_address
Required

create_server

Create a new Azure SQL Database server.

admin_login: The administrator login name for the new server.

admin_password: The administrator login password for the new server.

location: The region to deploy the new server.

create_server(admin_login, admin_password, location)

Parameters

admin_login
Required
admin_password
Required
location
Required

delete_database

Deletes an Azure SQL Database.

server_name: Name of the server where the database is located.

name: Name of the database to delete.

delete_database(server_name, name)

Parameters

server_name
Required
name
Required

delete_firewall_rule

Deletes an Azure SQL Database server firewall rule.

server_name: Name of the server with the firewall rule you want to delete.

name: Name of the firewall rule you want to delete.

delete_firewall_rule(server_name, name)

Parameters

server_name
Required
name
Required

delete_server

Deletes an Azure SQL Database server (including all its databases).

server_name: Name of the server you want to delete.

delete_server(server_name)

Parameters

server_name
Required

get_server_event_logs

Gets the event logs for an Azure SQL Database Server.

server_name: Name of the server to retrieve the event logs from.

start_date: The starting date and time of the events to retrieve in UTC format, for example '2011-09-28 16:05:00'.

interval_size_in_minutes: Size of the event logs to retrieve (in minutes). Valid values are: 5, 60, or 1440.

event_types: The event type of the log entries you want to retrieve. Valid values are:

  * connection_successful 

  * connection_failed 

  * connection_terminated 

  * deadlock 

  * throttling 

  * throttling_long_transaction 

To return all event types pass in an empty string.

get_server_event_logs(server_name, start_date, interval_size_in_minutes, event_types='')

Parameters

server_name
Required
start_date
Required
interval_size_in_minutes
Required
event_types

list_databases

List the SQL databases defined on the specified server name

list_databases(name)

Parameters

name
Required

list_firewall_rules

Retrieves the set of firewall rules for an Azure SQL Database Server.

server_name: Name of the server.

list_firewall_rules(server_name)

Parameters

server_name
Required

list_quotas

Gets quotas for an Azure SQL Database Server.

server_name: Name of the server.

list_quotas(server_name)

Parameters

server_name
Required

list_servers

List the SQL servers defined on the account.

list_servers()

list_service_level_objectives

Gets the service level objectives for an Azure SQL Database server.

server_name: Name of the server.

list_service_level_objectives(server_name)

Parameters

server_name
Required

set_server_admin_password

Reset the administrator password for a server.

server_name: Name of the server to change the password.

admin_password: The new administrator password for the server.

set_server_admin_password(server_name, admin_password)

Parameters

server_name
Required
admin_password
Required

update_database

Updates existing database details.

server_name: Name of the server to contain the new database.

name: Required. The name for the new database. See Naming Requirements in Azure SQL Database General Guidelines and Limitations and Database Identifiers for more information.

new_database_name: Optional. The new name for the new database.

service_objective_id: Optional. The new service level to apply to the database. For more information about service levels, see Azure SQL Database Service Tiers and Performance Levels. Use List Service Level Objectives to get the correct ID for the desired service objective.

edition: Optional. The new edition for the new database.

max_size_bytes: Optional. The new size of the database in bytes. For information on available sizes for each edition, see Azure SQL Database Service Tiers (Editions).

update_database(server_name, name, new_database_name=None, service_objective_id=None, edition=None, max_size_bytes=None)

Parameters

server_name
Required
name
Required
new_database_name
default value: None
service_objective_id
default value: None
edition
default value: None
max_size_bytes
default value: None

update_firewall_rule

Update a firewall rule for an Azure SQL Database server.

server_name: Name of the server to set the firewall rule on.

name: The name of the firewall rule to update.

start_ip_address: The lowest IP address in the range of the server-level firewall setting. IP addresses equal to or greater than this can attempt to connect to the server. The lowest possible IP address is 0.0.0.0.

end_ip_address: The highest IP address in the range of the server-level firewall setting. IP addresses equal to or less than this can attempt to connect to the server. The highest possible IP address is 255.255.255.255.

update_firewall_rule(server_name, name, start_ip_address, end_ip_address)

Parameters

server_name
Required
name
Required
start_ip_address
Required
end_ip_address
Required