Microsoft Azure Synapse Management Client Library for Python
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Dedicated SQL pool lifecycle management, configuration, scaling, security, and monitoring operations. SQL pools provide scalable data warehouse capabilities within Azure Synapse Analytics, supporting pause/resume, scaling, backup/restore, and comprehensive management operations.
Core SQL pool lifecycle management including creation, retrieval, updates, and deletion.
def get(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> SqlPool:
"""
Get a SQL pool.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
Returns:
SqlPool: The SQL pool object
"""
def create(resource_group_name: str, workspace_name: str, sql_pool_name: str, sql_pool_info: SqlPool) -> LROPoller[SqlPool]:
"""
Create a SQL pool.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
- sql_pool_info (SqlPool): SQL pool properties
Returns:
LROPoller[SqlPool]: Long-running operation poller
"""
def delete(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> LROPoller[object]:
"""
Delete a SQL pool.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
Returns:
LROPoller[object]: Long-running operation poller
"""
def update(resource_group_name: str, workspace_name: str, sql_pool_name: str, sql_pool_info: SqlPoolPatchInfo) -> LROPoller[SqlPool]:
"""
Update SQL pool properties.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
- sql_pool_info (SqlPoolPatchInfo): Update parameters
Returns:
LROPoller[SqlPool]: Long-running operation poller
"""Operations to control SQL pool state including pause and resume capabilities for cost management.
def pause(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> LROPoller[object]:
"""
Pause a SQL pool.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
Returns:
LROPoller[object]: Long-running operation poller
"""
def resume(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> LROPoller[object]:
"""
Resume a SQL pool.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
Returns:
LROPoller[object]: Long-running operation poller
"""Operations to list and discover SQL pools within workspaces.
def list_by_workspace(resource_group_name: str, workspace_name: str) -> ItemPaged[SqlPool]:
"""
List SQL pools in a workspace.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
Returns:
ItemPaged[SqlPool]: Paged collection of SQL pools
"""Configure metadata synchronization between SQL pools and other services.
def get_metadata_sync_config(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> MetadataSyncConfig:
"""
Get metadata sync configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
Returns:
MetadataSyncConfig: Metadata sync configuration
"""
def create_metadata_sync_config(resource_group_name: str, workspace_name: str, sql_pool_name: str, metadata_sync_configuration: MetadataSyncConfig) -> MetadataSyncConfig:
"""
Set metadata sync configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
- metadata_sync_configuration (MetadataSyncConfig): Sync configuration
Returns:
MetadataSyncConfig: Updated metadata sync configuration
"""Manage geo-redundant backup policies for disaster recovery.
def get_geo_backup_policy(resource_group_name: str, workspace_name: str, sql_pool_name: str, geo_backup_policy_name: str) -> GeoBackupPolicy:
"""
Get geo-backup policy.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
- geo_backup_policy_name (str): Name of the geo backup policy
Returns:
GeoBackupPolicy: Geo-backup policy
"""
def create_or_update_geo_backup_policy(resource_group_name: str, workspace_name: str, sql_pool_name: str, geo_backup_policy_name: str, parameters: GeoBackupPolicy) -> GeoBackupPolicy:
"""
Set geo-backup policy.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
- geo_backup_policy_name (str): Name of the geo backup policy
- parameters (GeoBackupPolicy): Geo-backup policy configuration
Returns:
GeoBackupPolicy: Updated geo-backup policy
"""Manage backup restore points for point-in-time recovery.
def list_restore_points(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> ItemPaged[RestorePoint]:
"""
List restore points for a SQL pool.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
Returns:
ItemPaged[RestorePoint]: Paged collection of restore points
"""
def create_restore_point(resource_group_name: str, workspace_name: str, sql_pool_name: str, parameters: CreateSqlPoolRestorePointDefinition) -> LROPoller[RestorePoint]:
"""
Create a restore point.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
- parameters (CreateSqlPoolRestorePointDefinition): Restore point definition
Returns:
LROPoller[RestorePoint]: Long-running operation poller
"""
def get_restore_point(resource_group_name: str, workspace_name: str, sql_pool_name: str, restore_point_name: str) -> RestorePoint:
"""
Get a specific restore point.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
- restore_point_name (str): Name of the restore point
Returns:
RestorePoint: The restore point
"""
def delete_restore_point(resource_group_name: str, workspace_name: str, sql_pool_name: str, restore_point_name: str) -> None:
"""
Delete a restore point.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
- restore_point_name (str): Name of the restore point
"""Configure maintenance windows for SQL pool updates and patches.
def get_maintenance_windows(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> MaintenanceWindows:
"""
Get maintenance windows configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
Returns:
MaintenanceWindows: Maintenance windows configuration
"""
def create_or_update_maintenance_windows(resource_group_name: str, workspace_name: str, sql_pool_name: str, parameters: MaintenanceWindows) -> None:
"""
Set maintenance windows configuration.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
- parameters (MaintenanceWindows): Maintenance windows configuration
"""
def get_maintenance_window_options(resource_group_name: str, workspace_name: str, sql_pool_name: str, maintenance_window_options_name: str) -> MaintenanceWindowOptions:
"""
Get available maintenance window options.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- sql_pool_name (str): Name of the SQL pool
- maintenance_window_options_name (str): Name of maintenance window options
Returns:
MaintenanceWindowOptions: Available maintenance window options
"""class SqlPool:
"""
A SQL Analytics pool.
Attributes:
- id (str): Resource ID
- name (str): Resource name
- type (str): Resource type
- location (str): Resource location
- tags (dict): Resource tags
- sku (Sku): SQL pool SKU
- max_size_bytes (int): Maximum size in bytes
- collation (str): Database collation
- source_database_id (str): Source database ID for restore
- recoverable_database_id (str): Recoverable database ID
- provisioning_state (str): Provisioning state
- status (str): Current status
- restore_point_name (str): Restore point name
- create_mode (str): Creation mode
- creation_date (datetime): Creation date
- storage_account_type (str): Storage account type
"""class SqlPoolPatchInfo:
"""
SQL pool patch properties.
Attributes:
- tags (dict): Resource tags
- sku (Sku): SQL pool SKU
- max_size_bytes (int): Maximum size in bytes
- collation (str): Database collation
- source_database_id (str): Source database ID
- recoverable_database_id (str): Recoverable database ID
- provisioning_state (str): Provisioning state
- status (str): Current status
- restore_point_name (str): Restore point name
- create_mode (str): Creation mode
- creation_date (datetime): Creation date
- storage_account_type (str): Storage account type
"""class RestorePoint:
"""
Database restore point.
Attributes:
- id (str): Resource ID
- name (str): Resource name
- type (str): Resource type
- location (str): Resource location
- restore_point_type (str): Type of restore point
- earliest_restore_date (datetime): Earliest restore date
- restore_point_creation_date (datetime): Creation date
- restore_point_label (str): Restore point label
"""class MetadataSyncConfig:
"""
Metadata sync configuration.
Attributes:
- id (str): Resource ID
- name (str): Resource name
- type (str): Resource type
- enabled (bool): Whether metadata sync is enabled
- sync_interval_in_minutes (int): Sync interval in minutes
"""from azure.mgmt.synapse.models import SqlPool, Sku
# Configure SQL pool properties
sku = Sku(name="DW100c")
sql_pool_info = SqlPool(
location="East US",
sku=sku,
collation="SQL_Latin1_General_CP1_CI_AS",
max_size_bytes=107374182400, # 100 GB
create_mode="Default"
)
# Create the SQL pool
operation = client.sql_pools.create(
resource_group_name="my-resource-group",
workspace_name="my-synapse-workspace",
sql_pool_name="my-sql-pool",
sql_pool_info=sql_pool_info
)
sql_pool = operation.result() # Wait for completion
print(f"Created SQL pool: {sql_pool.name}")# Pause the SQL pool to save costs
pause_operation = client.sql_pools.pause(
resource_group_name="my-resource-group",
workspace_name="my-synapse-workspace",
sql_pool_name="my-sql-pool"
)
pause_operation.result()
print("SQL pool paused")
# Resume the SQL pool
resume_operation = client.sql_pools.resume(
resource_group_name="my-resource-group",
workspace_name="my-synapse-workspace",
sql_pool_name="my-sql-pool"
)
resume_operation.result()
print("SQL pool resumed")from azure.mgmt.synapse.models import CreateSqlPoolRestorePointDefinition
restore_point_def = CreateSqlPoolRestorePointDefinition(
restore_point_label="BeforeUpdate"
)
operation = client.sql_pool_restore_points.create_restore_point(
resource_group_name="my-resource-group",
workspace_name="my-synapse-workspace",
sql_pool_name="my-sql-pool",
parameters=restore_point_def
)
restore_point = operation.result()
print(f"Created restore point: {restore_point.restore_point_label}")Install with Tessl CLI
npx tessl i tessl/pypi-azure-mgmt-synapse