1{
2 lib,
3 asn1crypto,
4 buildPythonPackage,
5 boto3,
6 botocore,
7 certifi,
8 cffi,
9 charset-normalizer,
10 cryptography,
11 cython,
12 fetchFromGitHub,
13 filelock,
14 idna,
15 keyring,
16 numpy,
17 packaging,
18 pandas,
19 platformdirs,
20 pyarrow,
21 pyjwt,
22 pyopenssl,
23 pytest-xdist,
24 pytestCheckHook,
25 pythonOlder,
26 pytz,
27 requests,
28 setuptools,
29 sortedcontainers,
30 tomlkit,
31 typing-extensions,
32}:
33
34buildPythonPackage rec {
35 pname = "snowflake-connector-python";
36 version = "3.16.0";
37 pyproject = true;
38
39 disabled = pythonOlder "3.8";
40
41 src = fetchFromGitHub {
42 owner = "snowflakedb";
43 repo = "snowflake-connector-python";
44 tag = "v${version}";
45 hash = "sha256-mow8TxmkeaMkgPTLUpx5Gucn4347gohHPyiBYjI/cDs=";
46 };
47
48 build-system = [
49 cython
50 setuptools
51 ];
52
53 dependencies = [
54 asn1crypto
55 boto3
56 botocore
57 certifi
58 cffi
59 charset-normalizer
60 cryptography
61 filelock
62 idna
63 packaging
64 platformdirs
65 pyjwt
66 pyopenssl
67 pytz
68 requests
69 sortedcontainers
70 tomlkit
71 typing-extensions
72 ];
73
74 pythonRelaxDeps = [
75 "pyopenssl"
76 ];
77
78 optional-dependencies = {
79 pandas = [
80 pandas
81 pyarrow
82 ];
83 secure-local-storage = [ keyring ];
84 };
85
86 preCheck = ''
87 export HOME=$(mktemp -d)
88 '';
89
90 nativeCheckInputs = [
91 numpy
92 pytest-xdist
93 pytestCheckHook
94 ];
95
96 disabledTestPaths = [
97 # Tests require encrypted secrets, see
98 # https://github.com/snowflakedb/snowflake-connector-python/tree/master/.github/workflows/parameters
99 "test/extras/simple_select1.py"
100 "test/integ"
101 # error getting schema from stream, error code: 0, error info: Expected to
102 # be able to read 19504 bytes for message body but got 19503
103 "test/unit/test_connection.py"
104 "test/unit/test_cursor.py"
105 "test/unit/test_error_arrow_stream.py"
106 "test/unit/test_ocsp.py"
107 "test/unit/test_retry_network.py"
108 "test/unit/test_s3_util.py"
109 # AssertionError: /build/source/.wiremock/wiremock-standalone.jar does not exist
110 "test/unit/test_programmatic_access_token.py"
111 "test/unit/test_oauth_token.py"
112 ];
113
114 disabledTests = [
115 # Tests connect to the internet
116 "test_status_when_num_of_chunks_is_zero"
117 "test_test_socket_get_cert"
118 # Missing .wiremock/wiremock-standalone.jar
119 "test_wiremock"
120 ];
121
122 pythonImportsCheck = [
123 "snowflake"
124 "snowflake.connector"
125 ];
126
127 meta = with lib; {
128 description = "Snowflake Connector for Python";
129 homepage = "https://github.com/snowflakedb/snowflake-connector-python";
130 changelog = "https://github.com/snowflakedb/snowflake-connector-python/blob/${src.tag}/DESCRIPTION.md";
131 license = licenses.asl20;
132 maintainers = [ ];
133 };
134}