GoogleCloudPlatform / GoogleCloudPlatform/professional-services-data-validator

Rendering of mysql datetime is likely problematic

Open
#1,502 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
524
Forks
171
Avg merge
5d 15h
Merged PRs (30d)
4

Description

**Describe the bug**
SQLAlchemy does not render date fields when using the [documented approach](https://docs.sqlalchemy.org/en/20/faq/sqlexpressions.html) - i.e. `print(s.compile(some_engine, compile_kwargs={"literal_binds": True}))` - you get the error `sqlalchemy.exc.CompileError: No literal value renderer is available for literal value "datetime.date(2023, 8, 23)" with datatype`.

This can be tested by replacing [this line](https://github.com/GoogleCloudPlatform/professional-services-data-validator/blob/a01334a576b0f7a02f6f7bf882941f6de22a184a/data_validation/util.py#L87) with `str(ibis_table.compile().compile(ibis_table._find_backend().con.engine,compile_kwargs={"literal_binds": True}))` and then running `pytest -k test_generate_partitions tests/system/data_sources/test_mysql.py`. The above error appears.

This could be because DVT does not provide an appropriate renderer for date for mysql. This may be happening for other engines.

**Additional context**
Issue discovered during [PR 1500](https://github.com/GoogleCloudPlatform/professional-services-data-validator/pull/1500)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.