1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pytestCheckHook
5, pythonOlder
6, duckdb
7, hypothesis
8, ipython-sql
9, poetry-core
10, snapshottest
11, sqlalchemy
12, typing-extensions
13}:
14
15buildPythonPackage rec {
16 pname = "duckdb-engine";
17 version = "0.7.3";
18 format = "pyproject";
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 repo = "duckdb_engine";
24 owner = "Mause";
25 rev = "refs/tags/v${version}";
26 hash = "sha256-Z9m1+Bc/csWKdPDuwf82xX0qOiD1Y5LBgJjUlLntAO8=";
27 };
28
29 nativeBuildInputs = [
30 poetry-core
31 ];
32
33 propagatedBuildInputs = [
34 duckdb
35 sqlalchemy
36 ];
37
38 preCheck = ''
39 export HOME="$(mktemp -d)"
40 '';
41
42 disabledTests = [
43 # this test tries to download the httpfs extension
44 "test_preload_extension"
45 # test should be skipped based on sqlalchemy version but isn't and fails
46 "test_commit"
47 ];
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 hypothesis
52 ipython-sql
53 # TODO(cpcloud): include pandas here when it supports sqlalchemy 2.0
54 snapshottest
55 typing-extensions
56 ];
57
58 pythonImportsCheck = [
59 "duckdb_engine"
60 ];
61
62 meta = with lib; {
63 description = "SQLAlchemy driver for duckdb";
64 homepage = "https://github.com/Mause/duckdb_engine";
65 changelog = "https://github.com/Mause/duckdb_engine/blob/v${version}/CHANGELOG.md";
66 license = licenses.mit;
67 maintainers = with maintainers; [ cpcloud ];
68 };
69}