0
# SQL Pool Management
1
2
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.
3
4
## Capabilities
5
6
### SQL Pool Operations
7
8
Core SQL pool lifecycle management including creation, retrieval, updates, and deletion.
9
10
```python { .api }
11
def get(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> SqlPool:
12
"""
13
Get a SQL pool.
14
15
Parameters:
16
- resource_group_name (str): Name of the resource group
17
- workspace_name (str): Name of the workspace
18
- sql_pool_name (str): Name of the SQL pool
19
20
Returns:
21
SqlPool: The SQL pool object
22
"""
23
24
def create(resource_group_name: str, workspace_name: str, sql_pool_name: str, sql_pool_info: SqlPool) -> LROPoller[SqlPool]:
25
"""
26
Create a SQL pool.
27
28
Parameters:
29
- resource_group_name (str): Name of the resource group
30
- workspace_name (str): Name of the workspace
31
- sql_pool_name (str): Name of the SQL pool
32
- sql_pool_info (SqlPool): SQL pool properties
33
34
Returns:
35
LROPoller[SqlPool]: Long-running operation poller
36
"""
37
38
def delete(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> LROPoller[object]:
39
"""
40
Delete a SQL pool.
41
42
Parameters:
43
- resource_group_name (str): Name of the resource group
44
- workspace_name (str): Name of the workspace
45
- sql_pool_name (str): Name of the SQL pool
46
47
Returns:
48
LROPoller[object]: Long-running operation poller
49
"""
50
51
def update(resource_group_name: str, workspace_name: str, sql_pool_name: str, sql_pool_info: SqlPoolPatchInfo) -> LROPoller[SqlPool]:
52
"""
53
Update SQL pool properties.
54
55
Parameters:
56
- resource_group_name (str): Name of the resource group
57
- workspace_name (str): Name of the workspace
58
- sql_pool_name (str): Name of the SQL pool
59
- sql_pool_info (SqlPoolPatchInfo): Update parameters
60
61
Returns:
62
LROPoller[SqlPool]: Long-running operation poller
63
"""
64
```
65
66
### SQL Pool State Management
67
68
Operations to control SQL pool state including pause and resume capabilities for cost management.
69
70
```python { .api }
71
def pause(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> LROPoller[object]:
72
"""
73
Pause a SQL pool.
74
75
Parameters:
76
- resource_group_name (str): Name of the resource group
77
- workspace_name (str): Name of the workspace
78
- sql_pool_name (str): Name of the SQL pool
79
80
Returns:
81
LROPoller[object]: Long-running operation poller
82
"""
83
84
def resume(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> LROPoller[object]:
85
"""
86
Resume a SQL pool.
87
88
Parameters:
89
- resource_group_name (str): Name of the resource group
90
- workspace_name (str): Name of the workspace
91
- sql_pool_name (str): Name of the SQL pool
92
93
Returns:
94
LROPoller[object]: Long-running operation poller
95
"""
96
```
97
98
### SQL Pool Listing
99
100
Operations to list and discover SQL pools within workspaces.
101
102
```python { .api }
103
def list_by_workspace(resource_group_name: str, workspace_name: str) -> ItemPaged[SqlPool]:
104
"""
105
List SQL pools in a workspace.
106
107
Parameters:
108
- resource_group_name (str): Name of the resource group
109
- workspace_name (str): Name of the workspace
110
111
Returns:
112
ItemPaged[SqlPool]: Paged collection of SQL pools
113
"""
114
```
115
116
### Metadata Sync Configuration
117
118
Configure metadata synchronization between SQL pools and other services.
119
120
```python { .api }
121
def get_metadata_sync_config(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> MetadataSyncConfig:
122
"""
123
Get metadata sync configuration.
124
125
Parameters:
126
- resource_group_name (str): Name of the resource group
127
- workspace_name (str): Name of the workspace
128
- sql_pool_name (str): Name of the SQL pool
129
130
Returns:
131
MetadataSyncConfig: Metadata sync configuration
132
"""
133
134
def create_metadata_sync_config(resource_group_name: str, workspace_name: str, sql_pool_name: str, metadata_sync_configuration: MetadataSyncConfig) -> MetadataSyncConfig:
135
"""
136
Set metadata sync configuration.
137
138
Parameters:
139
- resource_group_name (str): Name of the resource group
140
- workspace_name (str): Name of the workspace
141
- sql_pool_name (str): Name of the SQL pool
142
- metadata_sync_configuration (MetadataSyncConfig): Sync configuration
143
144
Returns:
145
MetadataSyncConfig: Updated metadata sync configuration
146
"""
147
```
148
149
### Geo-Backup Policies
150
151
Manage geo-redundant backup policies for disaster recovery.
152
153
```python { .api }
154
def get_geo_backup_policy(resource_group_name: str, workspace_name: str, sql_pool_name: str, geo_backup_policy_name: str) -> GeoBackupPolicy:
155
"""
156
Get geo-backup policy.
157
158
Parameters:
159
- resource_group_name (str): Name of the resource group
160
- workspace_name (str): Name of the workspace
161
- sql_pool_name (str): Name of the SQL pool
162
- geo_backup_policy_name (str): Name of the geo backup policy
163
164
Returns:
165
GeoBackupPolicy: Geo-backup policy
166
"""
167
168
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:
169
"""
170
Set geo-backup policy.
171
172
Parameters:
173
- resource_group_name (str): Name of the resource group
174
- workspace_name (str): Name of the workspace
175
- sql_pool_name (str): Name of the SQL pool
176
- geo_backup_policy_name (str): Name of the geo backup policy
177
- parameters (GeoBackupPolicy): Geo-backup policy configuration
178
179
Returns:
180
GeoBackupPolicy: Updated geo-backup policy
181
"""
182
```
183
184
### Restore Points
185
186
Manage backup restore points for point-in-time recovery.
187
188
```python { .api }
189
def list_restore_points(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> ItemPaged[RestorePoint]:
190
"""
191
List restore points for a SQL pool.
192
193
Parameters:
194
- resource_group_name (str): Name of the resource group
195
- workspace_name (str): Name of the workspace
196
- sql_pool_name (str): Name of the SQL pool
197
198
Returns:
199
ItemPaged[RestorePoint]: Paged collection of restore points
200
"""
201
202
def create_restore_point(resource_group_name: str, workspace_name: str, sql_pool_name: str, parameters: CreateSqlPoolRestorePointDefinition) -> LROPoller[RestorePoint]:
203
"""
204
Create a restore point.
205
206
Parameters:
207
- resource_group_name (str): Name of the resource group
208
- workspace_name (str): Name of the workspace
209
- sql_pool_name (str): Name of the SQL pool
210
- parameters (CreateSqlPoolRestorePointDefinition): Restore point definition
211
212
Returns:
213
LROPoller[RestorePoint]: Long-running operation poller
214
"""
215
216
def get_restore_point(resource_group_name: str, workspace_name: str, sql_pool_name: str, restore_point_name: str) -> RestorePoint:
217
"""
218
Get a specific restore point.
219
220
Parameters:
221
- resource_group_name (str): Name of the resource group
222
- workspace_name (str): Name of the workspace
223
- sql_pool_name (str): Name of the SQL pool
224
- restore_point_name (str): Name of the restore point
225
226
Returns:
227
RestorePoint: The restore point
228
"""
229
230
def delete_restore_point(resource_group_name: str, workspace_name: str, sql_pool_name: str, restore_point_name: str) -> None:
231
"""
232
Delete a restore point.
233
234
Parameters:
235
- resource_group_name (str): Name of the resource group
236
- workspace_name (str): Name of the workspace
237
- sql_pool_name (str): Name of the SQL pool
238
- restore_point_name (str): Name of the restore point
239
"""
240
```
241
242
### Maintenance Windows
243
244
Configure maintenance windows for SQL pool updates and patches.
245
246
```python { .api }
247
def get_maintenance_windows(resource_group_name: str, workspace_name: str, sql_pool_name: str) -> MaintenanceWindows:
248
"""
249
Get maintenance windows configuration.
250
251
Parameters:
252
- resource_group_name (str): Name of the resource group
253
- workspace_name (str): Name of the workspace
254
- sql_pool_name (str): Name of the SQL pool
255
256
Returns:
257
MaintenanceWindows: Maintenance windows configuration
258
"""
259
260
def create_or_update_maintenance_windows(resource_group_name: str, workspace_name: str, sql_pool_name: str, parameters: MaintenanceWindows) -> None:
261
"""
262
Set maintenance windows configuration.
263
264
Parameters:
265
- resource_group_name (str): Name of the resource group
266
- workspace_name (str): Name of the workspace
267
- sql_pool_name (str): Name of the SQL pool
268
- parameters (MaintenanceWindows): Maintenance windows configuration
269
"""
270
271
def get_maintenance_window_options(resource_group_name: str, workspace_name: str, sql_pool_name: str, maintenance_window_options_name: str) -> MaintenanceWindowOptions:
272
"""
273
Get available maintenance window options.
274
275
Parameters:
276
- resource_group_name (str): Name of the resource group
277
- workspace_name (str): Name of the workspace
278
- sql_pool_name (str): Name of the SQL pool
279
- maintenance_window_options_name (str): Name of maintenance window options
280
281
Returns:
282
MaintenanceWindowOptions: Available maintenance window options
283
"""
284
```
285
286
## Types
287
288
### SqlPool
289
290
```python { .api }
291
class SqlPool:
292
"""
293
A SQL Analytics pool.
294
295
Attributes:
296
- id (str): Resource ID
297
- name (str): Resource name
298
- type (str): Resource type
299
- location (str): Resource location
300
- tags (dict): Resource tags
301
- sku (Sku): SQL pool SKU
302
- max_size_bytes (int): Maximum size in bytes
303
- collation (str): Database collation
304
- source_database_id (str): Source database ID for restore
305
- recoverable_database_id (str): Recoverable database ID
306
- provisioning_state (str): Provisioning state
307
- status (str): Current status
308
- restore_point_name (str): Restore point name
309
- create_mode (str): Creation mode
310
- creation_date (datetime): Creation date
311
- storage_account_type (str): Storage account type
312
"""
313
```
314
315
### SqlPoolPatchInfo
316
317
```python { .api }
318
class SqlPoolPatchInfo:
319
"""
320
SQL pool patch properties.
321
322
Attributes:
323
- tags (dict): Resource tags
324
- sku (Sku): SQL pool SKU
325
- max_size_bytes (int): Maximum size in bytes
326
- collation (str): Database collation
327
- source_database_id (str): Source database ID
328
- recoverable_database_id (str): Recoverable database ID
329
- provisioning_state (str): Provisioning state
330
- status (str): Current status
331
- restore_point_name (str): Restore point name
332
- create_mode (str): Creation mode
333
- creation_date (datetime): Creation date
334
- storage_account_type (str): Storage account type
335
"""
336
```
337
338
### RestorePoint
339
340
```python { .api }
341
class RestorePoint:
342
"""
343
Database restore point.
344
345
Attributes:
346
- id (str): Resource ID
347
- name (str): Resource name
348
- type (str): Resource type
349
- location (str): Resource location
350
- restore_point_type (str): Type of restore point
351
- earliest_restore_date (datetime): Earliest restore date
352
- restore_point_creation_date (datetime): Creation date
353
- restore_point_label (str): Restore point label
354
"""
355
```
356
357
### MetadataSyncConfig
358
359
```python { .api }
360
class MetadataSyncConfig:
361
"""
362
Metadata sync configuration.
363
364
Attributes:
365
- id (str): Resource ID
366
- name (str): Resource name
367
- type (str): Resource type
368
- enabled (bool): Whether metadata sync is enabled
369
- sync_interval_in_minutes (int): Sync interval in minutes
370
"""
371
```
372
373
## Usage Examples
374
375
### Create a SQL Pool
376
377
```python
378
from azure.mgmt.synapse.models import SqlPool, Sku
379
380
# Configure SQL pool properties
381
sku = Sku(name="DW100c")
382
383
sql_pool_info = SqlPool(
384
location="East US",
385
sku=sku,
386
collation="SQL_Latin1_General_CP1_CI_AS",
387
max_size_bytes=107374182400, # 100 GB
388
create_mode="Default"
389
)
390
391
# Create the SQL pool
392
operation = client.sql_pools.create(
393
resource_group_name="my-resource-group",
394
workspace_name="my-synapse-workspace",
395
sql_pool_name="my-sql-pool",
396
sql_pool_info=sql_pool_info
397
)
398
399
sql_pool = operation.result() # Wait for completion
400
print(f"Created SQL pool: {sql_pool.name}")
401
```
402
403
### Pause and Resume SQL Pool
404
405
```python
406
# Pause the SQL pool to save costs
407
pause_operation = client.sql_pools.pause(
408
resource_group_name="my-resource-group",
409
workspace_name="my-synapse-workspace",
410
sql_pool_name="my-sql-pool"
411
)
412
pause_operation.result()
413
print("SQL pool paused")
414
415
# Resume the SQL pool
416
resume_operation = client.sql_pools.resume(
417
resource_group_name="my-resource-group",
418
workspace_name="my-synapse-workspace",
419
sql_pool_name="my-sql-pool"
420
)
421
resume_operation.result()
422
print("SQL pool resumed")
423
```
424
425
### Create Restore Point
426
427
```python
428
from azure.mgmt.synapse.models import CreateSqlPoolRestorePointDefinition
429
430
restore_point_def = CreateSqlPoolRestorePointDefinition(
431
restore_point_label="BeforeUpdate"
432
)
433
434
operation = client.sql_pool_restore_points.create_restore_point(
435
resource_group_name="my-resource-group",
436
workspace_name="my-synapse-workspace",
437
sql_pool_name="my-sql-pool",
438
parameters=restore_point_def
439
)
440
441
restore_point = operation.result()
442
print(f"Created restore point: {restore_point.restore_point_label}")
443
```