skillfed

databricks-labs-lsql

Lightweight stateless SQL execution for Databricks with minimal dependencies

databricks-labs-lsql v0.17.0 5.2M downloads/30d#2,129 on PyPI36
License unclear Active released

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-lsql

uv

uv add databricks-labs-lsql

poetry

poetry add databricks-labs-lsql

Installing 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

Development Status :: 3 - AlphaLicense :: Other/Proprietary LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

databricks sql execution pythonlightweight sql queries databricksstateless sql client databricksdatabricks sdk sql wrappersql result fetching databricksserverless sql databricksdatabricks statement execution
databricksserverlesssql-execution

More Database packages

psycopg2-binary

psycopg2-binary is a PostgreSQL database…

copyleft · top 1,000 on PyPI

redis

Python client library for connecting to and…

permissive · top 1,000 on PyPI

ydb

YDB Python SDK is the official client library…

permissive · top 1,000 on PyPI

snowflake-connector-python

Connects Python applications to Snowflake data…

permissive · top 1,000 on PyPI

sqlparse

sqlparse tokenizes SQL text into a tree of…

permissive · top 1,000 on PyPI

dbt-adapters

Provides base adapter protocols and shared…

permissive · top 1,000 on PyPI

databricks-sql

Provides a Python interface for querying and…

permissive · top 15,000 on PyPI

databricks-labs-blueprint

Provides Python-native pathlib-like interfaces…

unclear · top 1,000 on PyPI

databricks-sql-connector

A Python client library that connects to…

permissive · top 1,000 on PyPI

databricks-sqlalchemy

Provides a SQLAlchemy 2.0 dialect that bridges…

permissive · top 1,000 on PyPI

databricks-labs-remorph

Converts SQL code between different database…

unclear · top 5,000 on PyPI

dbt-databricks

dbt-databricks is a dbt adapter that enables…

permissive · top 5,000 on PyPI

sqlalchemy-databricks

Provides a SQLAlchemy dialect that connects to…

permissive · top 15,000 on PyPI

dbl-discoverx

DiscoverX automates bulk administration tasks…

unclear · top 15,000 on PyPI

databricks-labs-dqx

DQX provides rule-based data quality checking…

unclear · top 5,000 on PyPI

dbldatagen

Generates synthetic data at scale within…

unclear · top 15,000 on PyPI