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