diff --git a/sqlalchemy_bigquery/base.py b/sqlalchemy_bigquery/base.py index 7f4102fa..9e03425f 100644 --- a/sqlalchemy_bigquery/base.py +++ b/sqlalchemy_bigquery/base.py @@ -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