Environments
create_environment(workspace, display_name, *, environment_definition=None, description=None, folder=None, df=True)
Creates a new environment in the specified workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
display_name
|
str
|
The display name of the environment. |
required |
environment_definition
|
Dict[str, Any]
|
The environment definition. If Not provided, an empty definition will be used. |
None
|
description
|
str
|
A description for the environment. |
None
|
folder
|
str
|
The folder to create the environment in. |
None
|
df
|
Optional[bool]
|
If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries. |
True
|
Returns:
| Type | Description |
|---|---|
Union[DataFrame, Dict[str, Any], None]
|
The created environment details. |
Examples:
create_environment(
'MyProjectWorkspace', 'MyEnvironment', environment_definition={...}
)
Source code in src/pyfabricops/items/environments.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | |
delete_environment(workspace, environment)
Delete an environment from the specified workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The name or ID of the workspace to delete. |
required |
environment
|
str
|
The name or ID of the environment to delete. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
If the environment is successfully deleted. |
Raises:
| Type | Description |
|---|---|
ResourceNotFoundError
|
If the specified workspace is not found. |
Examples:
delete_environment('MyProjectWorkspace', 'MyEnvironment')
delete_environment('MyProjectWorkspace', '123e4567-e89b-12d3-a456-426614174000')
Source code in src/pyfabricops/items/environments.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
export_environment_external_libraries(workspace, environment)
Export environment external libraries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
environment
|
str
|
The name or ID of the environment. |
required |
Returns:
| Type | Description |
|---|---|
Union[Dict[str, Any], None]
|
The environment external libraries if found, otherwise None. |
Examples:
export_environment_external_libraries('MyProjectWorkspace', 'MyEnvironment')
export_environment_external_libraries('MyProjectWorkspace', '123e4567-e89b-12d3-a456-426614174000')
Source code in src/pyfabricops/items/environments.py
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | |
get_environment(workspace, environment, *, df=True)
Retrieves a specific environment from the workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
environment
|
str
|
The name or ID of the environment to retrieve. |
required |
df
|
Optional[bool]
|
If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries. |
True
|
Returns:
| Type | Description |
|---|---|
Union[DataFrame, Dict[str, Any], None]
|
The environment details as a dictionary or DataFrame, or None if not found. |
Examples:
get_environment('MyProjectWorkspace', 'MyEnvironment')
get_environment('MyProjectWorkspace', '123e4567-e89b-12d3-a456-426614174000', df=True)
Source code in src/pyfabricops/items/environments.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
get_environment_definition(workspace, environment)
Retrieves the definition of an environment by its name or ID from the specified workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
environment
|
str
|
The name or ID of the environment. |
required |
Returns:
| Type | Description |
|---|---|
Union[Dict[str, Any], None]
|
The environment definition if found, otherwise None. |
Examples:
get_environment_definition('MyProjectWorkspace', 'MyEnvironment')
get_environment_definition('MyProjectWorkspace', '123e4567-e89b-12d3-a456-426614174000')
Source code in src/pyfabricops/items/environments.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
get_environment_id(workspace, environment)
Retrieves the ID of a specific environment in the workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
environment
|
str
|
The name of the environment. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
str|None: The ID of the environment, or None if not found. |
Examples:
get_environment_id('MyProjectWorkspace', 'MyEnvironment')
get_environment_id('MyProjectWorkspace', '123e4567-e89b-12d3-a456-426614174000')
Source code in src/pyfabricops/items/environments.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
get_environment_spark_compute(workspace, environment)
Get environment staging spark compute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
environment
|
str
|
The name or ID of the environment. |
required |
Returns:
| Type | Description |
|---|---|
Union[Dict[str, Any], None]
|
The environment definition if found, otherwise None. |
Examples:
get_environment_spark_compute('MyProjectWorkspace', 'MyEnvironment')
get_environment_spark_compute('MyProjectWorkspace', '123e4567-e89b-12d3-a456-426614174000')
Source code in src/pyfabricops/items/environments.py
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | |
import_environment_external_libraries(workspace, environment)
Import external libraries from environment.yaml in the environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
environment
|
str
|
The name or ID of the environment. |
required |
Returns:
| Type | Description |
|---|---|
Union[Dict[str, Any], None]
|
The environment external libraries if found, otherwise None. |
Examples:
import_environment_external_libraries('MyProjectWorkspace', 'MyEnvironment')
import_environment_external_libraries('MyProjectWorkspace', '123e4567-e89b-12d3-a456-426614174000')
Source code in src/pyfabricops/items/environments.py
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
list_environments(workspace, *, df=True)
Returns a list of environments from the specified workspace. This API supports pagination.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
df
|
Optional[bool]
|
If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries. |
True
|
Returns:
| Type | Description |
|---|---|
Union[DataFrame, List[Dict[str, Any]], None]
|
A list of environments, excluding those that start with the specified prefixes. If |
Examples:
list_environments('MyProjectWorkspace')
list_environments('MyProjectWorkspace', df=False)
Source code in src/pyfabricops/items/environments.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
publish_environment(workspace, environment, df=True)
Trigger an environment publish operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
environment
|
str
|
The name or ID of the environment to publish. |
required |
Returns:
| Type | Description |
|---|---|
Union[DataFrame, Dict[str, Any], None]
|
The published environment details if successful, otherwise None. |
Examples:
publish_environment(
'MyProjectWorkspace',
'MyEnvironment'
)
Source code in src/pyfabricops/items/environments.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
resolve_environment(workspace, environment)
Resolves an environment name to its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The ID of the workspace. |
required |
environment
|
str
|
The name of the environment. |
required |
Returns:
| Type | Description |
|---|---|
Union[str, None]
|
The ID of the environment, or None if not found. |
Examples:
resolve_environment('MyProjectWorkspace', 'MyEnvironment')
resolve_environment('MyProjectWorkspace', '123e4567-e89b-12d3-a456-426614174000')
Source code in src/pyfabricops/items/environments.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
update_environment(workspace, environment, *, display_name=None, description=None, df=True)
Updates the properties of the specified environment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
environment
|
str
|
The name or ID of the environment to update. |
required |
display_name
|
str
|
The new display name for the environment. |
None
|
description
|
str
|
The new description for the environment. |
None
|
df
|
Optional[bool]
|
If True or not provided, returns a DataFrame with flattened keys. If False, returns a list of dictionaries. |
True
|
Returns:
| Type | Description |
|---|---|
Union[DataFrame, Dict[str, Any], None]
|
The updated environment details if successful, otherwise None. |
Examples:
update_environment('MyProjectWorkspace', 'MyEnvironment', display_name='UpdatedMyEnvironment')
update_environment('MyProjectWorkspace', '123e4567-e89b-12d3-a456-426614174000', description='Updated description')
Source code in src/pyfabricops/items/environments.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
update_environment_definition(workspace, environment, environment_definition, df=True)
Updates the definition of an existing environment in the specified workspace. If the environment does not exist, it returns None.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
environment
|
str
|
The name or ID of the environment to update. |
required |
environment_definition
|
Dict[str, Any]
|
The updated environment definition. |
required |
Returns:
| Type | Description |
|---|---|
Union[DataFrame, Dict[str, Any], None]
|
The updated environment details if successful, otherwise None. |
Examples:
update_environment_definition(
'MyProjectWorkspace',
'MyEnvironment',
environment_definition = {...} # Updated environment definition
)
Source code in src/pyfabricops/items/environments.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
update_environment_spark_compute(workspace, environment, *, pool=None, driver_cores=None, driver_memory=None, executor_cores=None, executor_memory=None, dynamic_executor_allocation_enabled=None, min_executors=None, max_executors=None, spark_properties=None, runtime_version=None)
Update environment staging spark compute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace
|
str
|
The workspace name or ID. |
required |
environment
|
str
|
The name or ID of the environment. |
required |
Returns:
| Type | Description |
|---|---|
Union[Dict[str, Any], None]
|
The environment definition if found, otherwise None. |
Examples:
update_environment_spark_compute(
'MyProjectWorkspace',
'MyEnvironment',
pool='Custom Pool Name',
)
update_environment_spark_compute(
'MyProjectWorkspace',
'MyEnvironment',
pool='Custom Pool Name',
driver_cores=8,
driver_memory='56g',
executor_cores=8,
executor_memory='56g',
dynamic_executor_allocation_enabled=True,
min_executors=1,
max_executors=9,
spark_properties=[
{"key": "spark.sql.caseSensitive", "value": "true"}
],
runtime_version='1.3'
)
Source code in src/pyfabricops/items/environments.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | |