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