1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 poetry-core,
8
9 # dependencies
10 duckdb,
11 sqlalchemy,
12
13 # testing
14 fsspec,
15 hypothesis,
16 pandas,
17 pyarrow,
18 pytest-remotedata,
19 pytestCheckHook,
20 pythonAtLeast,
21 pythonOlder,
22 snapshottest,
23 typing-extensions,
24}:
25
26buildPythonPackage rec {
27 pname = "duckdb-engine";
28 version = "0.17.0";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 repo = "duckdb_engine";
33 owner = "Mause";
34 tag = "v${version}";
35 hash = "sha256-AhYCiIhi7jMWKIdDwZZ8MgfDg3F02/jooGLOp6E+E5g=";
36 };
37
38 build-system = [ poetry-core ];
39
40 dependencies = [
41 duckdb
42 sqlalchemy
43 ];
44
45 preCheck = ''
46 export HOME="$(mktemp -d)"
47 '';
48
49 nativeCheckInputs = [ pytestCheckHook ];
50
51 checkInputs = [
52 fsspec
53 hypothesis
54 pandas
55 pyarrow
56 pytest-remotedata
57 typing-extensions
58 ]
59 ++ lib.optionals (pythonOlder "3.12") [
60 # requires wasmer which is broken for python 3.12
61 # https://github.com/wasmerio/wasmer-python/issues/778
62 snapshottest
63 ];
64
65 disabledTestPaths = lib.optionals (pythonAtLeast "3.12") [
66 # requires snapshottest
67 "duckdb_engine/tests/test_datatypes.py"
68 ];
69
70 disabledTestMarks = [
71 "remote_data"
72 ];
73
74 disabledTests = [
75 # user agent not available in nixpkgs
76 "test_user_agent"
77 "test_user_agent_with_custom_user_agent"
78
79 # Fail under nixpkgs-review in the sandbox due to "missing tables"
80 "test_get_columns"
81 "test_get_foreign_keys"
82 "test_get_check_constraints"
83 "test_get_unique_constraints"
84 ];
85
86 pythonImportsCheck = [ "duckdb_engine" ];
87
88 meta = {
89 description = "SQLAlchemy driver for duckdb";
90 homepage = "https://github.com/Mause/duckdb_engine";
91 changelog = "https://github.com/Mause/duckdb_engine/blob/${src.tag}/CHANGELOG.md";
92 license = lib.licenses.mit;
93 maintainers = with lib.maintainers; [ cpcloud ];
94 };
95}