Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 5a2fc40

Browse files
committed
Prevent import time error if no BIGNUMERIC support
1 parent 21ae123 commit 5a2fc40

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

google/cloud/bigquery/_pandas_helpers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def pyarrow_timestamp():
107107
"INT64": pyarrow.int64,
108108
"INTEGER": pyarrow.int64,
109109
"NUMERIC": pyarrow_numeric,
110-
"BIGNUMERIC": pyarrow_bignumeric,
111110
"STRING": pyarrow.string,
112111
"TIME": pyarrow_time,
113112
"TIMESTAMP": pyarrow_timestamp,
@@ -134,10 +133,13 @@ def pyarrow_timestamp():
134133
pyarrow.binary().id: "BYTES",
135134
pyarrow.string().id: "STRING", # also alias for pyarrow.utf8()
136135
pyarrow.decimal128(38, scale=9).id: "NUMERIC",
136+
}
137+
138+
if int(pyarrow.__version__.split(".")[0]) >= 3:
139+
BQ_TO_ARROW_SCALARS["BIGNUMERIC"] = pyarrow_bignumeric
137140
# The exact decimal's scale and precision are not important, as only
138141
# the type ID matters, and it's the same for all decimal128 instances.
139-
pyarrow.decimal256(76, scale=38).id: "BIGNUMERIC",
140-
}
142+
ARROW_SCALAR_IDS_TO_BQ[pyarrow.decimal256(76, scale=38).id] = "BIGNUMERIC"
141143

142144
else: # pragma: NO COVER
143145
BQ_TO_ARROW_SCALARS = {} # pragma: NO COVER

0 commit comments

Comments
 (0)