Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions sqlalchemy_bigquery/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,11 +630,12 @@ def visit_NUMERIC(self, type_, **kw):
else:
suffix = ""

# From the GCP Console for BQ when creating a NUMERIC column:
# > precision and scale for NUMERIC must be: 0 <= precision - scale <= 29
return (
"BIGNUMERIC"
if (type_.precision is not None and type_.precision > 38)
or (type_.scale is not None and type_.scale > 9)
else "NUMERIC"
"NUMERIC"
if (0 <= (type_.precision or 0) - (type_.scale or 0) <= 29)
else "BIGNUMERIC"
) + suffix

visit_DECIMAL = visit_NUMERIC
Expand Down