Variable Libraries¶
Variable Libraries store typed named variables and alternative value sets for use in ALM pipelines. Different value sets can be activated per deployment stage (dev/test/prod), letting the same pipeline run with different configurations.
Accessing a Variable Library¶
import fabias
ws = fabias.workspace("GENESIS")
lib = ws.variableLibrary("Deployment Config")
print(f"Active value set: {lib.active_value_set}")
Listing Variable Libraries¶
import fabias
ws = fabias.workspace("GENESIS")
for lib in ws.variableLibraries():
print(f"{lib.name}: {lib.active_value_set}")
Reading Variables¶
import fabias
ws = fabias.workspace("GENESIS")
lib = ws.variableLibrary("Deployment Config")
# Iterate variables in the active value set
for var in lib.variables():
print(f"{var.name} ({var.type}): {var.value}")
# Get a single variable value
env = lib.variable("environment").value
Setting Variables¶
import fabias
ws = fabias.workspace("GENESIS")
lib = ws.variableLibrary("Deployment Config")
lib.setVariables([
{"name": "environment", "type": "String", "value": "dev"},
{"name": "maxRetries", "type": "Integer", "value": 3},
{"name": "enabled", "type": "Boolean", "value": True},
])
Value Sets¶
Value sets are named groups of variable overrides — one per deployment stage.
import fabias
ws = fabias.workspace("GENESIS")
lib = ws.variableLibrary("Deployment Config")
# List value sets
for vs in lib.valueSets():
print(vs["name"])
# Create or update a value set
lib.setValueSet("Production", {
"environment": "prod",
"maxRetries": "10",
"enabled": "true"
})
# Activate a value set
lib.activateValueSet("Production")
# Delete a value set
lib.deleteValueSet("OldStaging")
ItemReference Variables¶
Reference other Fabric items by workspace + item ID:
from fabias import Variable, ItemReference
ref = ItemReference(
workspace_id="workspace-guid",
item_id="lakehouse-guid"
)
Variable Types¶
| Type | Python value |
|---|---|
String |
str |
Integer |
int |
Number |
float |
Boolean |
bool |
DateTime |
ISO 8601 string |
ItemReference |
ItemReference object |