1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 google-api-core,
11 google-cloud-bigquery-storage,
12 google-cloud-core,
13 google-resumable-media,
14 grpcio,
15 proto-plus,
16 protobuf,
17 python-dateutil,
18 requests,
19
20 # optional-dependencies
21 pyarrow,
22 db-dtypes,
23 pandas,
24 tqdm,
25 ipython,
26
27 # tests
28 freezegun,
29 google-cloud-datacatalog,
30 google-cloud-storage,
31 google-cloud-testutils,
32 mock,
33 psutil,
34 pytest-xdist,
35 pytestCheckHook,
36}:
37
38buildPythonPackage rec {
39 pname = "google-cloud-bigquery";
40 version = "3.35.1";
41 pyproject = true;
42
43 src = fetchPypi {
44 pname = "google_cloud_bigquery";
45 inherit version;
46 hash = "sha256-WZ8mys8ZCs/ogAD2zF9Lyea6rHiZ5PQGygVPGQb3GWA=";
47 };
48
49 build-system = [ setuptools ];
50
51 dependencies = [
52 google-api-core
53 google-cloud-bigquery-storage
54 google-cloud-core
55 google-resumable-media
56 grpcio
57 proto-plus
58 protobuf
59 python-dateutil
60 requests
61 ]
62 ++ google-api-core.optional-dependencies.grpc;
63
64 optional-dependencies = {
65 bqstorage = [
66 google-cloud-bigquery-storage
67 grpcio
68 pyarrow
69 ];
70 pandas = [
71 db-dtypes
72 pandas
73 pyarrow
74 ];
75 tqdm = [ tqdm ];
76 ipython = [ ipython ];
77 };
78
79 nativeCheckInputs = [
80 freezegun
81 google-cloud-datacatalog
82 google-cloud-storage
83 google-cloud-testutils
84 mock
85 psutil
86 pytest-xdist
87 pytestCheckHook
88 ]
89 ++ optional-dependencies.pandas
90 ++ optional-dependencies.ipython;
91
92 # prevent google directory from shadowing google imports
93 preCheck = ''
94 rm -r google
95 '';
96
97 disabledTests = [
98 # requires credentials
99 "TestBigQuery"
100 "test_arrow_extension_types_same_for_storage_and_REST_APIs_894"
101 "test_bigquery_magic"
102 "test_context_with_no_query_cache_from_context"
103 "test_dry_run"
104 "test_list_rows_empty_table"
105 "test_list_rows_page_size"
106 "test_list_rows_range"
107 "test_list_rows_range_csv"
108 "test_list_rows_scalars"
109 "test_list_rows_scalars_extreme"
110 "test_session"
111 "test_to_arrow_query_with_empty_result"
112
113 # Mocking of _ensure_bqstorage_client fails
114 "test_to_arrow_ensure_bqstorage_client_wo_bqstorage"
115
116 # requires network
117 "test__initiate_resumable_upload"
118 "test__initiate_resumable_upload_mtls"
119 "test__initiate_resumable_upload_with_retry"
120 "test_context_with_custom_connection"
121 "test_context_with_default_connection"
122 "test_dbapi_create_view"
123 "test_list_rows_nullable_scalars_dtypes"
124 "test_parameterized_types_round_trip"
125 "test_structs"
126 "test_table_clones"
127 "test_table_snapshots"
128 ];
129
130 disabledTestPaths = [
131 # Tests require credentials
132 "tests/system/test_job_retry.py"
133 "tests/system/test_pandas.py"
134 "tests/system/test_query.py"
135
136 # ModuleNotFoundError: No module named 'google.cloud.resourcemanager_v3'
137 "tests/system/test_client.py"
138 ];
139
140 pythonImportsCheck = [
141 "google.cloud.bigquery"
142 "google.cloud.bigquery_v2"
143 ];
144
145 meta = {
146 description = "Google BigQuery API client library";
147 homepage = "https://github.com/googleapis/python-bigquery";
148 changelog = "https://github.com/googleapis/python-bigquery/blob/v${version}/CHANGELOG.md";
149 license = lib.licenses.asl20;
150 maintainers = [ ];
151 };
152}