duckdb_sqlalchemy/contains the dialect implementation and helpers (for exampledatatypes.py,url.py,olap.py,config.py).duckdb_sqlalchemy/tests/holds pytest suites; snapshot fixtures live induckdb_sqlalchemy/tests/snapshots/.examples/provides runnable examples such asexamples/sqlalchemy_example.py.- Tooling and metadata are in
pyproject.toml,noxfile.py, and.pre-commit-config.yaml.
pip install -e ".[dev]"installs dev dependencies for local runs.pip install -e ".[dev,devtools]"also installspre-commit.nox -s testsruns the full test matrix (multiple Python, DuckDB, and SQLAlchemy versions); expect this to be slow.pytestruns tests in the current environment (useful for quick checks).nox -s tyruns type checking withty.pre-commit run --all-filesapplies formatting/lint checks via the configured hooks.
- Python code uses 4-space indentation and standard naming:
snake_casefor functions/variables andCamelCasefor classes. - Linting and formatting are enforced with Ruff (
ruff+ruff-format) via pre-commit. - Type hints are expected in new code;
tyis the canonical checker.
- Tests use
pytestwith plugins includingpytest-cov,pytest-remotedata, andpytest-snapshot. - Name tests
test_*.pyand keep them underduckdb_sqlalchemy/tests/. - Snapshot assertions are stored under
duckdb_sqlalchemy/tests/snapshots/and should be updated intentionally.
- Recent history favors short, imperative subjects and occasionally uses Conventional Commit prefixes (for example
chore:,build:). - PRs should include a clear summary, test results, and linked issues when applicable.
- For user-facing changes, consider updating
CHANGELOG.md.
- Never commit secrets. Use environment variables for MotherDuck tokens (
MOTHERDUCK_TOKENormotherduck_token).
- Use
pre-committo run checks before committing. - Always create a new branch for each feature or bug fix. After you completed the work, create a pull request with a concise title and description of the changes. Then wait for tests to pass and finally merge the changes into the main branch.