diff --git a/test-requirements.txt b/test-requirements.txt index 012697ec..3cbcd696 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -46,6 +46,6 @@ sqlalchemy==1.4.26 pylint-protobuf cython freezegun==1.2.2 -pytest-cov +# pytest-cov yandexcloud -e . diff --git a/ydb/types.py b/ydb/types.py index 2d4eecc3..887008c4 100644 --- a/ydb/types.py +++ b/ydb/types.py @@ -33,8 +33,10 @@ def _from_date(x: ydb_value_pb2.Value, table_client_settings: table.TableClientS return x.uint32_value -def _to_date(pb: ydb_value_pb2.Value, value: typing.Union[date, int]) -> None: - if isinstance(value, date): +def _to_date(pb: ydb_value_pb2.Value, value: typing.Union[date, datetime, int]) -> None: + if isinstance(value, datetime): + pb.uint32_value = (value.date() - _EPOCH.date()).days + elif isinstance(value, date): pb.uint32_value = (value - _EPOCH.date()).days else: pb.uint32_value = value