summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/duckdb-engine/default.nix
blob: 46f5917acefc77deff08d3180fb938b2e1cc694f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  poetry-core,

  # dependencies
  duckdb,
  sqlalchemy,

  # testing
  fsspec,
  hypothesis,
  pandas,
  pyarrow,
  pytest-remotedata,
  pytestCheckHook,
  pythonAtLeast,
  pythonOlder,
  snapshottest,
  typing-extensions,
}:

buildPythonPackage rec {
  pname = "duckdb-engine";
  version = "0.17.0";
  pyproject = true;

  src = fetchFromGitHub {
    repo = "duckdb_engine";
    owner = "Mause";
    tag = "v${version}";
    hash = "sha256-AhYCiIhi7jMWKIdDwZZ8MgfDg3F02/jooGLOp6E+E5g=";
  };

  build-system = [ poetry-core ];

  dependencies = [
    duckdb
    sqlalchemy
  ];

  preCheck = ''
    export HOME="$(mktemp -d)"
  '';

  nativeCheckInputs = [ pytestCheckHook ];

  checkInputs = [
    fsspec
    hypothesis
    pandas
    pyarrow
    pytest-remotedata
    typing-extensions
  ]
  ++ lib.optionals (pythonOlder "3.12") [
    # requires wasmer which is broken for python 3.12
    # https://github.com/wasmerio/wasmer-python/issues/778
    snapshottest
  ];

  disabledTestPaths = lib.optionals (pythonAtLeast "3.12") [
    # requires snapshottest
    "duckdb_engine/tests/test_datatypes.py"
  ];

  disabledTestMarks = [
    "remote_data"
  ];

  disabledTests = [
    # user agent not available in nixpkgs
    "test_user_agent"
    "test_user_agent_with_custom_user_agent"

    # Fail under nixpkgs-review in the sandbox due to "missing tables"
    "test_get_columns"
    "test_get_foreign_keys"
    "test_get_check_constraints"
    "test_get_unique_constraints"
    # https://github.com/Mause/duckdb_engine/issues/1379
    "test_reflect"
    "test_get_multi_columns"
    "test_table_reflect"
    "test_comment_support"
    "test_361"
    "test_reflection"
    "test_fetch_arrow"
  ];

  pythonImportsCheck = [ "duckdb_engine" ];

  meta = {
    description = "SQLAlchemy driver for duckdb";
    homepage = "https://github.com/Mause/duckdb_engine";
    changelog = "https://github.com/Mause/duckdb_engine/blob/${src.tag}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ cpcloud ];
  };
}