1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 pythonAtLeast,
7 pythonOlder,
8 python,
9 duckdb,
10 hypothesis,
11 pandas,
12 pyarrow,
13 poetry-core,
14 pytest-remotedata,
15 snapshottest,
16 sqlalchemy,
17 typing-extensions,
18}:
19
20buildPythonPackage rec {
21 pname = "duckdb-engine";
22 version = "0.13.4";
23 pyproject = true;
24
25 disabled = pythonOlder "3.8";
26
27 src = fetchFromGitHub {
28 repo = "duckdb_engine";
29 owner = "Mause";
30 rev = "refs/tags/v${version}";
31 hash = "sha256-B9vh8OILmRZKKznBbEkkm3zlAwGwMGdiuc378msiywE=";
32 };
33
34 nativeBuildInputs = [ poetry-core ];
35
36 propagatedBuildInputs = [
37 duckdb
38 sqlalchemy
39 ];
40
41 preCheck = ''
42 export HOME="$(mktemp -d)"
43 '';
44
45 nativeCheckInputs = [ pytestCheckHook ];
46
47 checkInputs = [
48 hypothesis
49 pandas
50 pytest-remotedata
51 typing-extensions
52 pyarrow
53 ] ++ lib.optionals (pythonOlder "3.12") [
54 # requires wasmer which is broken for python 3.12
55 # https://github.com/wasmerio/wasmer-python/issues/778
56 snapshottest
57 ];
58
59 pytestFlagsArray = [
60 "-m"
61 "'not remote_data'"
62 ];
63
64 disabledTestPaths = lib.optionals (pythonAtLeast "3.12") [
65 # requires snapshottest
66 "duckdb_engine/tests/test_datatypes.py"
67 ];
68
69 disabledTests = [
70 # incompatible with duckdb 1.1.1
71 "test_with_cache"
72 ] ++ lib.optionals (python.pythonVersion == "3.11") [
73 # incompatible with duckdb 1.1.1
74 "test_all_types_reflection"
75 "test_nested_types"
76 ];
77
78 pythonImportsCheck = [ "duckdb_engine" ];
79
80 meta = with lib; {
81 description = "SQLAlchemy driver for duckdb";
82 homepage = "https://github.com/Mause/duckdb_engine";
83 changelog = "https://github.com/Mause/duckdb_engine/blob/v${version}/CHANGELOG.md";
84 license = licenses.mit;
85 maintainers = with maintainers; [ cpcloud ];
86 };
87}