Skip to content

Commit db88b8d

Browse files
authored
BigQuery: Add enum with SQL type names allowed to be used in SchemaField (#9040)
* Add enum with legacy SQL type names * Add standard types to enum, rename enum
1 parent 027bd0c commit db88b8d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

bigquery/google/cloud/bigquery/enums.py

+23
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,26 @@ def _make_sql_scalars_enum():
6767

6868

6969
StandardSqlDataTypes = _make_sql_scalars_enum()
70+
71+
72+
# See also: https://cloud.google.com/bigquery/data-types#legacy_sql_data_types
73+
# and https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types
74+
class SqlTypeNames(str, enum.Enum):
75+
"""Enum of allowed SQL type names in schema.SchemaField."""
76+
77+
STRING = "STRING"
78+
BYTES = "BYTES"
79+
INTEGER = "INTEGER"
80+
INT64 = "INTEGER"
81+
FLOAT = "FLOAT"
82+
FLOAT64 = "FLOAT"
83+
NUMERIC = "NUMERIC"
84+
BOOLEAN = "BOOLEAN"
85+
BOOL = "BOOLEAN"
86+
GEOGRAPHY = "GEOGRAPHY" # NOTE: not available in legacy types
87+
RECORD = "RECORD"
88+
STRUCT = "RECORD"
89+
TIMESTAMP = "TIMESTAMP"
90+
DATE = "DATE"
91+
TIME = "TIME"
92+
DATETIME = "DATETIME"

0 commit comments

Comments
 (0)