Files
windmill/system_prompts/auto-generated/sdks/datatable-python.md
T
Ruben FiszelandClaude Opus 5.5 85e73ae4f1 feat: add the viewer's roles to a data table connection that names none
The default role of a data table under roles is now a floor: a connection
naming no role also holds the roles its viewer is a tenant of, unless the
default is admin. This replaces the explicit as=viewer option, which is
removed from the reference parser, the executors and both clients. The roles
drawer warns while the default is admin and confirms before removing the
default role.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 09:27:24 +02:00

1.9 KiB

Python Datatable API (wmill)

Import: import wmill

Get a DataTable client for SQL queries.

Args:

name: Database name (default: "main")

role: Connect as this data table role instead of the data table's default one.

Returns:

DataTableClient instance

def datatable(name: str = 'main', *, role: Optional[str] = None) -> DataTableClient

Client for executing SQL queries against Windmill DataTables.

class DataTableClient: # Initialize DataTableClient. # # Args: # client: Windmill client instance # name: DataTable name # role: Data table role to connect as, or None for the data table's default def init(client: Windmill, name: str, role: Optional[str] = None)

# Execute a SQL query against the DataTable.
# 
# Args:
#     sql: SQL query string with $1, $2, etc. placeholders
#     *args: Positional arguments to bind to query placeholders
# 
# Returns:
#     SqlQuery instance for fetching results
def query(sql: str, *args) -> SqlQuery

Query result handler for DataTable and DuckLake queries.

class SqlQuery: # Initialize SqlQuery. # # Args: # sql: SQL query string # fetch_fn: Function to execute the query def init(sql: str, fetch_fn)

# Execute query and fetch results.
# 
# Args:
#     result_collection: Optional result collection mode
# 
# Returns:
#     Query results
def fetch(result_collection: str | None = None)

# Execute query and fetch first row of results.
# 
# Returns:
#     First row of query results
def fetch_one()

# Execute query and fetch first row of results. Return result as a scalar value.
# 
# Returns:
#     First row of query result as a scalar value
def fetch_one_scalar()

# Execute query and don't return any results.
#         
def execute()