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.9.2";
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-T02nGF+YlughRQPinb0I3NC6xsarh4+qRhG8YfhTvhI=";
27 };
28
29 patches = [ ./remote_data.patch ];
30
31 nativeBuildInputs = [
32 poetry-core
33 ];
34
35 propagatedBuildInputs = [
36 duckdb
37 sqlalchemy
38 ];
39
40 preCheck = ''
41 export HOME="$(mktemp -d)"
42 '';
43
44 disabledTests = [
45 # this test tries to download the httpfs extension
46 "test_preload_extension"
47 "test_motherduck"
48 # test should be skipped based on sqlalchemy version but isn't and fails
49 "test_commit"
50 # rowcount no longer generates an attribute error.
51 "test_rowcount"
52 ];
53
54 nativeCheckInputs = [
55 pytestCheckHook
56 hypothesis
57 ipython-sql
58 # TODO(cpcloud): include pandas here when it supports sqlalchemy 2.0
59 snapshottest
60 typing-extensions
61 ];
62
63 pythonImportsCheck = [
64 "duckdb_engine"
65 ];
66
67 meta = with lib; {
68 description = "SQLAlchemy driver for duckdb";
69 homepage = "https://github.com/Mause/duckdb_engine";
70 changelog = "https://github.com/Mause/duckdb_engine/blob/v${version}/CHANGELOG.md";
71 license = licenses.mit;
72 maintainers = with maintainers; [ cpcloud ];
73 };
74}