Skip to content

Commit

Permalink
BigQuery: Add enum with SQL type names allowed to be used in SchemaFi…
Browse files Browse the repository at this point in the history
…eld (googleapis#9040)

* Add enum with legacy SQL type names

* Add standard types to enum, rename enum
  • Loading branch information
plamut authored Aug 20, 2019
1 parent 027bd0c commit db88b8d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions bigquery/google/cloud/bigquery/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,26 @@ def _make_sql_scalars_enum():


StandardSqlDataTypes = _make_sql_scalars_enum()


# See also: https://cloud.google.com/bigquery/data-types#legacy_sql_data_types
# and https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types
class SqlTypeNames(str, enum.Enum):
"""Enum of allowed SQL type names in schema.SchemaField."""

STRING = "STRING"
BYTES = "BYTES"
INTEGER = "INTEGER"
INT64 = "INTEGER"
FLOAT = "FLOAT"
FLOAT64 = "FLOAT"
NUMERIC = "NUMERIC"
BOOLEAN = "BOOLEAN"
BOOL = "BOOLEAN"
GEOGRAPHY = "GEOGRAPHY" # NOTE: not available in legacy types
RECORD = "RECORD"
STRUCT = "RECORD"
TIMESTAMP = "TIMESTAMP"
DATE = "DATE"
TIME = "TIME"
DATETIME = "DATETIME"

0 comments on commit db88b8d

Please sign in to comment.