Skip to content

Commit d68cf17

Browse files
1 parent 8bde85d commit d68cf17

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

‎sqlalchemy_bigquery/base.py‎

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -845,31 +845,39 @@ def _process_time_partitioning(
845845

846846
sqltypes = {
847847
# column_type | truncation func OR default value | partitioning_period(s)
848-
849-
"_PARTITIONDATE": ("_PARTITIONDATE", None), # default value, no period
850-
"_PARTITIONTIME": ("DATE", None), # trunc_fn, no period
848+
"_PARTITIONDATE": ("_PARTITIONDATE", None), # default value, no period
849+
"_PARTITIONTIME": ("DATE", None), # trunc_fn, no period
851850
"DATE": {
852-
"no_period": (None, None), # date_column, no trunc_fn, no period
853-
"period": ("DATE_TRUNC", {"MONTH", "YEAR"}), # date_column, trunc_fn, period(s)
854-
},
851+
"no_period": (None, None), # date_column, no trunc_fn, no period
852+
"period": (
853+
"DATE_TRUNC",
854+
{"MONTH", "YEAR"},
855+
), # date_column, trunc_fn, period(s)
856+
},
855857
"DATETIME": {
856-
"no_period": ("DATE", None), # datetime_column, trunc_fn, no period
857-
"period": ("DATETIME_TRUNC", {"DAY", "HOUR", "MONTH", "YEAR"}), # datetime_column, trunc_fn, period(s)
858-
},
858+
"no_period": ("DATE", None), # datetime_column, trunc_fn, no period
859+
"period": (
860+
"DATETIME_TRUNC",
861+
{"DAY", "HOUR", "MONTH", "YEAR"},
862+
), # datetime_column, trunc_fn, period(s)
863+
},
859864
"TIMESTAMP": {
860-
"no_period": ("DATE", None), # timestamp_column, trunc_fn, no period
861-
"period": ("TIMESTAMP_TRUNC", {"DAY", "HOUR", "MONTH", "YEAR"}), # timestamp_column, trunc_fn, period(s)
865+
"no_period": ("DATE", None), # timestamp_column, trunc_fn, no period
866+
"period": (
867+
"TIMESTAMP_TRUNC",
868+
{"DAY", "HOUR", "MONTH", "YEAR"},
869+
), # timestamp_column, trunc_fn, period(s)
862870
},
863871
}
864872

865873
def parse_sqltypes(coltype, partitioning_period):
866874
"""Returns the default value OR the truncation function to be used
867875
and the allowed partitioning periods.
868876
"""
869-
877+
870878
if coltype in {"_PARTITIONDATE", "_PARTITIONTIME"}:
871879
return sqltypes[coltype]
872-
880+
873881
# by this point, value must be a nested dict
874882
if partitioning_period is None:
875883
# use "no_period" key

0 commit comments

Comments
 (0)