eventhouse_writer
sqllocks_spindle.fabric.eventhouse_writer
¶
Write generated data to a Fabric Eventhouse (KQL database).
Uses the Azure Kusto SDK for table creation and managed streaming ingestion into KQL databases hosted on Microsoft Fabric.
Requires the fabric-kusto extra::
pip install sqllocks-spindle[fabric-kusto]
Classes¶
EventhouseWriteResult
dataclass
¶
Result of an Eventhouse write operation.
EventhouseWriter
¶
Write generated data to a Fabric Eventhouse (KQL database).
Supports
- Fabric Eventhouse (*.kusto.fabric.microsoft.com)
Authentication methods
"cli"— Azure CLI (az login), default for local dev"msi"— Managed Identity, for Fabric Notebooks / Azure VMs"spn"— Service Principal, for CI/CD pipelines
Usage::
writer = EventhouseWriter(
cluster_uri="https://my-eventhouse.z0.kusto.fabric.microsoft.com",
database="MyKQLDatabase",
auth_method="cli",
)
result = writer.write(generation_result, table_prefix="gen_")
Methods:¶
write(result, table_prefix='', batch_size=10000)
¶
Write all tables from a GenerationResult or dict of DataFrames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
Any
|
A GenerationResult or dict[str, DataFrame]. |
required |
table_prefix
|
str
|
Optional prefix for KQL table names. |
''
|
batch_size
|
int
|
Rows per ingestion batch. |
10000
|
Returns:
| Type | Description |
|---|---|
EventhouseWriteResult
|
EventhouseWriteResult with per-table row counts and any errors. |
write_all(tables, **kwargs)
¶
Write all tables — protocol-compatible alias for write().
Conforms to the SpindleWriter protocol so EventhouseWriter can be used with MultiStoreWriter.