databricks-labs-lsql
Lightweight stateless SQL execution for Databricks with minimal dependencies
What it is and what it does
Databricks Labs LSQL is a lightweight wrapper around the Databricks Python SDK that simplifies executing SQL queries and fetching results without maintaining a persistent connection. It is designed for stateless, short-lived applications—such as serverless functions—where minimal dependencies and fast startup time matter more than high-throughput data transfer. The package provides methods to execute queries, iterate over results as Row-like objects, fetch single records or values, and map results to strongly-typed Python dataclasses.
The library abstracts over multiple SQL backends (REST-based statement execution, Databricks Connect, runtime execution, and mocks for testing) so you can swap implementations without changing application code. It trades the efficient binary serialization and low-latency result fetching of the full Databricks SQL Connector for a smaller footprint and simpler dependency chain, making it well-suited for containerized or Lambda-like deployments where startup overhead is a constraint.
Use it for:
- Execute ad-hoc SQL queries from AWS Lambda or Azure Functions without heavy client libraries.
- Fetch a single aggregated value (count, sum, max) from a Databricks table in a lightweight script.
- Map query results directly to Python dataclasses for type-safe data handling in microservices.
- Unit test code that interacts with Databricks SQL using the MockBackend without a live warehouse.
- Build CLI tools or batch jobs that run SQL statements and iterate over results with minimal startup latency.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Executes SQL queries against Databricks through the Python SDK with minimal dependencies, returning results as iterators or single values without requiring a persistent connection.
Yes, if you are building serverless or containerized applications on Databricks and need lightweight SQL execution without the overhead of the full SQL Connector. The low install friction, active maintenance, and lack of known vulnerabilities make it a safe choice. However, verify the unclear license terms before committing to a production deployment, and confirm that the REST-based result fetching meets your performance requirements if you are moving large datasets.
Install
databricks-labs-lsql on PyPI
pip
pip install databricks-labs-lsqluv
uv add databricks-labs-lsqlpoetry
poetry add databricks-labs-lsqlInstalling databricks-labs-lsql
Before you install
Low install friction with a pure-Python wheel and only three runtime dependencies. Actively maintained as of 2026-08-03 with recent releases, though marked as Alpha status.
License in practice
License treatment is unclear—no SPDX identifier or raw license text is available in the metadata. Verify the actual license terms before use in proprietary or commercial projects.
Quickstart
from databricks.sdk import WorkspaceClient
from databricks.labs.lsql.core import StatementExecutionExt
w = WorkspaceClient()
see = StatementExecutionExt(w)
for row in see.fetch_all('SELECT * FROM table LIMIT 10'):
print(row)
Requires Databricks workspace credentials and a running warehouse; WorkspaceClient must be authenticated via environment or configuration.
Verify before relying
- Whether the unclear license is compatible with your project's legal requirements.
- Performance characteristics when fetching hundreds of megabytes or gigabytes of data compared to Databricks SQL Connector.
- Stability guarantees beyond Alpha status and whether breaking changes are expected.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (<3.15,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — databricks-labs-blueprint, databricks-sdk, sqlglot |
| Maintenance | actively maintained — 144 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,245,959/month — #2,129 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: databricks_labs_lsql-0.17.0-py3-none-any.whl
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
databricks-sqlProvides a Python interface for querying and…
permissive · top 15,000 on PyPI
databricks-labs-blueprintProvides Python-native pathlib-like interfaces…
unclear · top 1,000 on PyPI
databricks-sql-connectorA Python client library that connects to…
permissive · top 1,000 on PyPI
databricks-sqlalchemyProvides a SQLAlchemy 2.0 dialect that bridges…
permissive · top 1,000 on PyPI
databricks-labs-remorphConverts SQL code between different database…
unclear · top 5,000 on PyPI
dbt-databricksdbt-databricks is a dbt adapter that enables…
permissive · top 5,000 on PyPI
sqlalchemy-databricksProvides a SQLAlchemy dialect that connects to…
permissive · top 15,000 on PyPI
dbl-discoverxDiscoverX automates bulk administration tasks…
unclear · top 15,000 on PyPI
databricks-labs-dqxDQX provides rule-based data quality checking…
unclear · top 5,000 on PyPI
dbldatagenGenerates synthetic data at scale within…
unclear · top 15,000 on PyPI