Fabric API - Tables
write_table, load_table, list_tables and wait_for_operation, with every parameter.
The four methods below work with lakehouse tables. Each takes the workspace ID and the lakehouse ID first.
write_table
Writes a list of dicts to a table and returns once the data is in it. The rows are written as CSV files to Files/zato/<table_name>/<timestamp>/ in the lakehouse, 100,000 rows per file, then loaded into the table, and the SQL analytics endpoint is refreshed for that table, so the rows are visible to query as soon as the call returns.
| Parameter | Type | Meaning |
|---|---|---|
workspace_id | str | The workspace the lakehouse is in |
lakehouse_id | str | The lakehouse the table is in |
table_name | str | The table to write to, created if it does not exist |
rows | list of dict | The rows, all with the keys of the first one, which become the columns |
mode | str | Overwrite replaces the table with the rows, Append adds them to what is there |
Returns the completed operation as a dict, with status set to Succeeded. A load that fails raises an exception with the operation's details.
# -*- coding: utf-8 -*-
# Zato
from zato.server.service import Service
class WriteTable(Service):
def handle(self):
workspace_id = '262ddd3d-3d0d-4495-b80f-6dddda1e23a1'
lakehouse_id = '73811955-064d-481a-a7e9-f9c563124f9e'
conn = self.microsoft.fabric['Zato Fabric']
rows = [
{'insurer_id': 'INS-1', 'name': 'Cascade Health Plan'},
{'insurer_id': 'INS-2', 'name': 'Pacific Mutual'},
{'insurer_id': 'INS-3', 'name': 'Evergreen Assurance'},
]
operation = conn.write_table(workspace_id, lakehouse_id, 'insurers', rows)
self.response.payload = {'status': operation['status']}
load_table
conn.load_table(workspace_id, lakehouse_id, table_name, relative_path, mode='Overwrite',
file_format='Csv', header=True, delimiter=',', path_type='File', recursive=False)
Starts loading a file or a folder from the lakehouse's Files section into a table and returns without waiting.
| Parameter | Type | Meaning |
|---|---|---|
workspace_id | str | The workspace the lakehouse is in |
lakehouse_id | str | The lakehouse the table and the file are in |
table_name | str | The table to load into, created if it does not exist |
relative_path | str | The file or folder, relative to the lakehouse, e.g. Files/incoming/invoices-2026-08.csv |
mode | str | Overwrite or Append, as in write_table |
file_format | str | Csv or Parquet |
header | bool | CSV only - whether the first line holds the column names |
delimiter | str | CSV only - the character between values |
path_type | str | File when relative_path is one file, Folder when it is a folder of files |
recursive | bool | Folders only - whether to include files in subfolders |
Returns the address of the operation's status endpoint as a string, for wait_for_operation.
# -*- coding: utf-8 -*-
# Zato
from zato.server.service import Service
class LoadTable(Service):
def handle(self):
workspace_id = '262ddd3d-3d0d-4495-b80f-6dddda1e23a1'
lakehouse_id = '73811955-064d-481a-a7e9-f9c563124f9e'
conn = self.microsoft.fabric['Zato Fabric']
location = conn.load_table(
workspace_id,
lakehouse_id,
'admissions',
'Files/incoming/admissions',
mode='Append',
file_format='Parquet',
path_type='Folder',
recursive=True,
)
self.response.payload = {'location': location}
wait_for_operation
Waits until a long-running operation ends and returns its final state. load_table returns such a location.
| Parameter | Type | Meaning |
|---|---|---|
location | str | The address load_table returned |
timeout | int | Seconds to wait before giving up |
interval | float | Seconds between checks |
Returns the operation as a dict with status set to Succeeded. An operation that fails raises an exception with its details, one that does not end within timeout raises an exception naming the location.
# -*- coding: utf-8 -*-
# Zato
from zato.server.service import Service
class LoadAndWait(Service):
def handle(self):
workspace_id = '262ddd3d-3d0d-4495-b80f-6dddda1e23a1'
lakehouse_id = '73811955-064d-481a-a7e9-f9c563124f9e'
conn = self.microsoft.fabric['Zato Fabric']
location = conn.load_table(
workspace_id,
lakehouse_id,
'invoices',
'Files/incoming/invoices-2026-08.csv',
mode='Append',
)
operation = conn.wait_for_operation(location, timeout=300)
self.response.payload = {'status': operation['status']}
list_tables
Returns every table of a lakehouse as a list of dicts.
| Parameter | Type | Meaning |
|---|---|---|
workspace_id | str | The workspace the lakehouse is in |
lakehouse_id | str | The lakehouse to list |
Each dict has name, type, location and format.
# -*- coding: utf-8 -*-
# Zato
from zato.server.service import Service
class ListTables(Service):
def handle(self):
workspace_id = '262ddd3d-3d0d-4495-b80f-6dddda1e23a1'
lakehouse_id = '73811955-064d-481a-a7e9-f9c563124f9e'
conn = self.microsoft.fabric['Zato Fabric']
tables = conn.list_tables(workspace_id, lakehouse_id)
names = []
for table in tables:
names.append(table['name'])
self.response.payload = {'tables': names}
{"tables": ["admissions", "appointments", "insurers", "inventory", "invoices", "locations", "occupancy", "staff"]}
See also
| Page | What it covers |
|---|---|
| Fabric API - Queries | Reading the tables back with query, and refresh_sql_endpoint after a load_table |
| Fabric API - Files | Putting the files load_table reads into the lakehouse |
| Writing data to Fabric | A nightly append, a small table replaced, a file loaded and a file written |