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

conn.write_table(workspace_id, lakehouse_id, table_name, rows, mode='Overwrite')

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.

ParameterTypeMeaning
workspace_idstrThe workspace the lakehouse is in
lakehouse_idstrThe lakehouse the table is in
table_namestrThe table to write to, created if it does not exist
rowslist of dictThe rows, all with the keys of the first one, which become the columns
modestrOverwrite 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.

ParameterTypeMeaning
workspace_idstrThe workspace the lakehouse is in
lakehouse_idstrThe lakehouse the table and the file are in
table_namestrThe table to load into, created if it does not exist
relative_pathstrThe file or folder, relative to the lakehouse, e.g. Files/incoming/invoices-2026-08.csv
modestrOverwrite or Append, as in write_table
file_formatstrCsv or Parquet
headerboolCSV only - whether the first line holds the column names
delimiterstrCSV only - the character between values
path_typestrFile when relative_path is one file, Folder when it is a folder of files
recursiveboolFolders 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

conn.wait_for_operation(location, timeout=600, interval=2.0)

Waits until a long-running operation ends and returns its final state. load_table returns such a location.

ParameterTypeMeaning
locationstrThe address load_table returned
timeoutintSeconds to wait before giving up
intervalfloatSeconds 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

conn.list_tables(workspace_id, lakehouse_id)

Returns every table of a lakehouse as a list of dicts.

ParameterTypeMeaning
workspace_idstrThe workspace the lakehouse is in
lakehouse_idstrThe 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

PageWhat it covers
Fabric API - QueriesReading the tables back with query, and refresh_sql_endpoint after a load_table
Fabric API - FilesPutting the files load_table reads into the lakehouse
Writing data to FabricA nightly append, a small table replaced, a file loaded and a file written

Learn more