lakehouse_table_write
Write a Spark DataFrame to a Fabric lakehouse Delta table.
This writes to the lakehouse Tables/ area using the ABFSS root stored in
a Housepath. Use this in the Unified/Product stage after transformations,
DQ checks, and technical-column enrichment are complete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Spark DataFrame to write. |
required |
lh
|
Housepath
|
Lakehouse path object returned by |
required |
tablename
|
str
|
Target table name under the lakehouse |
required |
mode
|
str
|
Spark write mode. Supported values are |
"append"
|
partition_by
|
str or list[str]
|
Column or columns used to physically partition the Delta table. |
None
|
repartition_by
|
int, str, list, or tuple
|
Optional repartitioning before write. |
None
|
overwrite_schema
|
bool
|
Whether to set Spark Delta |
True
|
Returns:
| Type | Description |
|---|---|
None
|
The DataFrame is written to the target Delta table path. |
Notes
Side effects:
- Persists data to OneLake Delta storage under Tables/<tablename>.
- Optional repartitioning can change output file sizing and partition
layout.
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> lh_unified = get_path("Sandbox", "Unified", config=CONFIG)
>>> lakehouse_table_write(
... df,
... lh_unified,
... "CLEAN_ORDERS",
... mode="overwrite",
... partition_by="p_bucket",
... repartition_by=(200, "p_bucket"),
... )
Source code in src/fabricops_kit/fabric_io.py
185 186 187 188 189 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 221 222 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 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |