Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support RANGE query parameters #1827

Merged
merged 14 commits into from
Mar 4, 2024
Prev Previous commit
Next Next commit
fix typos and improve docstrings
  • Loading branch information
Linchin committed Feb 29, 2024
commit 7b6fc41f9b600742758467c9d4f3307b831daa1b
2 changes: 1 addition & 1 deletion benchmark/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _is_datetime_min(time_str: str) -> bool:


def _summary(run: dict) -> str:
"""Coverts run dict to run summary string."""
"""Converts run dict to run summary string."""
no_val = "NODATA"
output = ["QUERYTIME "]

Expand Down
10 changes: 5 additions & 5 deletions google/cloud/bigquery/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,8 @@ class RangeQueryParameter(_AbstractQueryParameter):

Args:
range_element_type (Union[str, RangeQueryParameterType]):
The type of range elements. If given as a string, it must be one of
'TIMESTAMP', 'DATE', or 'DATETIME'.
The type of range elements. It must be one of 'TIMESTAMP',
'DATE', or 'DATETIME'.

start (Optional[Union[ScalarQueryParameter, str]]):
The start of the range value. Must be the same type as
Expand Down Expand Up @@ -992,7 +992,7 @@ def _serialize_range_element_value(self, value, type_):
return converter(value) # type: ignore
else:
raise ValueError(
f"Cannot covert range element value from type {type_}, "
f"Cannot convert range element value from type {type_}, "
"must be one of the strings 'TIMESTAMP', 'DATE' "
"'DATETIME' or a RangeQueryParameterType object."
)
Expand All @@ -1018,8 +1018,8 @@ def positional(

Args:
range_element_type (Union[str, RangeQueryParameterType]):
The type of range elements. If given as a string, it must be
one of `'TIMESTAMP'`, `'DATE'`, or `'DATETIME'`.
The type of range elements. It must be one of `'TIMESTAMP'`,
`'DATE'`, or `'DATETIME'`.

start (Optional[Union[ScalarQueryParameter, str]]):
The start of the range value. Must be the same type as
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ def test_to_api_repr_wo_values(self):

def test_to_api_repr_unsupported_value_type(self):
with self.assertRaisesRegex(
ValueError, "Cannot covert range element value from type"
ValueError, "Cannot convert range element value from type"
):
range_param = self._make_one(
range_element_type="DATE", start=datetime.date.today()
Expand Down