PyStackQL - a Python wrapper for the StackQL query engine, which runs SQL against cloud and SaaS providers. Published to PyPI as pystackql.
pystackql/core/- main logicstackql.py-StackQLclass, the primary public interface (execute,executeStmt,executeQueriesAsync,properties,upgrade,test_connection)query.py-QueryExecutor/AsyncQueryExecutorserver.py-ServerConnection(server mode via psycopg/postgres wire protocol)output.py-OutputFormatter(output formats:dict,pandas,csv,markdownkv)binary.py-BinaryManager(locates/downloads the stackql binary)error_detector.py-ErrorDetector, matches messages against patterns inpystackql/errors.yaml
pystackql/utils/- platform, binary, download, auth, and param helpers (re-exported fromutils/__init__.py)pystackql/magic_ext/- Jupyter magics:StackqlMagic(local) andStackqlServerMagic(server), sharingbase.pypystackql/__init__.py- public API:StackQL,StackqlMagic,StackqlServerMagic
- Local mode (default): downloads/runs the stackql binary as a subprocess.
- Server mode (
server_mode=True): connects to a running stackql server over the postgres wire protocol.csvoutput and several local-only options are unsupported here.
Tests use the no-auth Homebrew provider and provider-agnostic literal queries (avoid adding auth-requiring tests).
- Non-server tests:
python run_tests.py(optionally pass specifictests/test_*.pyfiles,-v) - Server tests: start a server first (
stackql srv --pgsrv.address 127.0.0.1 --pgsrv.port 5466), thenpython run_server_tests.py - CI (
.github/workflows/test.yaml) runs both across Linux/macOS/Windows and Python 3.9-3.13.
- Supports Python 3.9-3.13 on Windows, macOS, and Linux - keep changes cross-platform.
README.rstis reStructuredText (the PyPI readme); docs indocs/build to ReadTheDocs from Sphinx-style docstrings. Update theStackQL.__init__docstring when changing constructor params.- Bump
versioninpyproject.tomlfor releases; record changes inCHANGELOG.md.