quacklab Python adapter
The quacklab Python adapter integrates quacklab into the DuckDB Python package. quacklab is a research project to integrate optimizer hints into DuckDB. These hints overwrite optimizer decisions like the join order or cardinality estimates:
import quacklab
db = quacklab.connect("imdb.duckdb")
hints = "/*=quack_lab= card(t #42) card(mi #24) */" # this comment will be embedded in the SQL query
db.sql(f"explain {hints} select count(*) from title t join movie_info mi on t.id = mi.movie_id where t.production_year < 2010")
Repo Layout
The quacklab-patches branch is used to track our changes to upstream DuckDB. It should not be used directly.
For the DuckDB versions that we support, dedicated quacklab-[DuckDB release] branches exist, such as quacklab-v2.0-cyanoptera.
These branches are used to apply our quacklab patches to the specific DuckDB release. Use these branches to build quacklab.
Installation
See the quacklab repository for information on the required software to compile quacklab. In addition to these requirements, the DuckDB Python adapter also needs uv to build the Python package. For quacklab we adhere to the standard build process as far as possible.
The TLDR is
git clone --recurse-submodules https://github.com/rbergm/quacklab-python.git
cd quacklab-python
git fetch --tags
git switch quacklab-v2.0-cyanoptera
git submodule update --init --recursive
cd external/duckdb && git fetch --tags
cd ../..
uv build
Or to explain the individual steps:
- Make sure you have tags available in the repository:
git fetch --tags. Tags are used for versioning by the DuckDB build process. - Select the package version you want to build by checking out the corresponding branch, e.g.,
git switch quacklab-v2.0-cyanoptera - Check out the matching quacklab submodule:
git submodule update --init --recursive. Run this again whenever you switch to a different branch. - Make sure you have tags available in the quacklab submodule:
cd external/duckdb && git fetch --tags - Back in the main directory, you can start the package build:
uv build. This will automatically compile DuckDB/quacklab from source, so this process will take a while. - Install the quacklab wheel into whatever Python environment you want, e.g. using
pip install dist/quacklab-<suffix>.whl.
The parser for the hinting grammar is checked into quacklab, so no Java runtime is needed for the build. If you change the grammar, see the quacklab repository for how to regenerate the parser.
Usage
The Python adapter can be used like the standard DuckDB package. Queries that contain hints are automatically processed by quacklab. Refer to the official DuckDB documentation and quacklab documentation for details.
Metadata
Release files for quacklab 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| quacklab-2.0.2.tar.gz | 21.6 MB | Without provenance | Details for quacklab-2.0.2.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| quacklab-2.0.2-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for quacklab-2.0.2-cp312-abi3-win_amd64.whl |
| quacklab-2.0.2-cp312-abi3-manylinux_2_38_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.38+ x86-64 | Details for quacklab-2.0.2-cp312-abi3-manylinux_2_38_x86_64.whl |
| quacklab-2.0.2-cp312-abi3-macosx_26_0_arm64.whl | CPython 3.12 | abi3 | macOS 26.0+ ARM64 | Details for quacklab-2.0.2-cp312-abi3-macosx_26_0_arm64.whl |
Total release size: 82.2 MB
Release files / quacklab-2.0.2.tar.gz
| Download URL | quacklab-2.0.2.tar.gz |
|---|---|
| Size | 21.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
770caa6a79b046330cf08b00f7e9fe64c37380cdadf2873f8a85005db7431321
|
|
BLAKE2b-256 checksum How to use checksums |
3e4c39ab1a664a6d40aae24b50092c86661f94e77ba77d817f98a82f2954a72f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / quacklab-2.0.2-cp312-abi3-win_amd64.whl
| Download URL | quacklab-2.0.2-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 15.9 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b6be79f387e0bb2685505772a79ffe755c0f8a4dd282cdc0081db787d2b1a63c
|
|
BLAKE2b-256 checksum How to use checksums |
2028b449d72f3b703d380570385de99fe4dffe65b7b91e3e56129e4541e55ed7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / quacklab-2.0.2-cp312-abi3-manylinux_2_38_x86_64.whl
| Download URL | quacklab-2.0.2-cp312-abi3-manylinux_2_38_x86_64.whl |
|---|---|
| Size | 25.7 MB |
| Tags | CPython 3.12 Linux glibc 2.38+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5ad88cb2f5000a6f536aad75aa672846c827d3cc0c12969bc0bb00e67007418b
|
|
BLAKE2b-256 checksum How to use checksums |
9fbc3202d33909b17600b443f569a845edec58e55a9e66d6bb5ca2dc0c6b10db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / quacklab-2.0.2-cp312-abi3-macosx_26_0_arm64.whl
| Download URL | quacklab-2.0.2-cp312-abi3-macosx_26_0_arm64.whl |
|---|---|
| Size | 18.9 MB |
| Tags | CPython 3.12 abi3 macOS 26.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
745fd314021df08cb39a17e6913d38a83e872d1afc6850e78e621c0236aca9a1
|
|
BLAKE2b-256 checksum How to use checksums |
2236eda9a9ec12767dc5d3fd8a3033f6b42a6d5b33d89254185e365fce7cb621
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for quacklab 2.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.