1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 alembic,
6 lz4,
7 numpy,
8 oauthlib,
9 openpyxl,
10 pandas,
11 poetry-core,
12 pyarrow,
13 pytestCheckHook,
14 pythonOlder,
15 pythonAtLeast,
16 sqlalchemy,
17 thrift,
18 requests,
19 urllib3,
20 fetchpatch,
21}:
22
23buildPythonPackage rec {
24 pname = "databricks-sql-connector";
25 version = "3.3.0";
26 format = "pyproject";
27
28 # Depends on thrift that at the moment do not work in Python 3.12
29 # see PR 328415 fix this.
30 disabled = pythonOlder "3.7" || pythonAtLeast "3.12";
31
32 src = fetchFromGitHub {
33 owner = "databricks";
34 repo = "databricks-sql-python";
35 rev = "refs/tags/v${version}";
36 hash = "sha256-a3OeKJ3c2UCClsPMah7iJY2YvIVLfHmmBuHAx8vdXZs=";
37 };
38
39 patches = [
40 (fetchpatch {
41 name = "fix-pandas.patch";
42 url = "https://patch-diff.githubusercontent.com/raw/databricks/databricks-sql-python/pull/416.patch";
43 sha256 = "sha256-sNCp8xSSmKP2yNzDK4wyWC5Hoe574AeHnKTeNcIxaek=";
44 })
45 ];
46
47 pythonRelaxDeps = [
48 "pyarrow"
49 ];
50
51 nativeBuildInputs = [
52 poetry-core
53 ];
54
55 propagatedBuildInputs = [
56 alembic
57 lz4
58 numpy
59 oauthlib
60 openpyxl
61 pandas
62 pyarrow
63 sqlalchemy
64 thrift
65 requests
66 urllib3
67 ];
68
69 nativeCheckInputs = [ pytestCheckHook ];
70
71 pytestFlagsArray = [ "tests/unit" ];
72
73 pythonImportsCheck = [ "databricks" ];
74
75 meta = with lib; {
76 description = "Databricks SQL Connector for Python";
77 homepage = "https://docs.databricks.com/dev-tools/python-sql-connector.html";
78 changelog = "https://github.com/databricks/databricks-sql-python/blob/v${version}/CHANGELOG.md";
79 license = licenses.asl20;
80 maintainers = with maintainers; [ harvidsen ];
81 };
82}