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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bind Interval data type to Python timedelta #552

Closed
rad-pat opened this issue Dec 31, 2024 · 3 comments · Fixed by #567
Closed

feat: bind Interval data type to Python timedelta #552

rad-pat opened this issue Dec 31, 2024 · 3 comments · Fixed by #567

Comments

@rad-pat
Copy link

rad-pat commented Dec 31, 2024

I'm trying to introduce Interval datatype to SQLAlchemy dialect which uses BendSQL as a driver.
Can we please have the Interval type map to a Python datetime.timedelta, currently it is returned as string and causes test failures on the SQLAlchemy side, e.g.
AssertionError: ('24:00:04',) != (datetime.timedelta(days=1, seconds=4),)

@everpcpc
Copy link
Member

everpcpc commented Jan 6, 2025

cc @TCeason could you help with this?

@rad-pat
Copy link
Author

rad-pat commented Jan 6, 2025

FYI, I have worked around this for the time being by parsing the string result: https://github.com/PlaidCloud/databend-sqlalchemy/blob/interval/databend_sqlalchemy/types.py#L88..L109

@TCeason
Copy link
Collaborator

TCeason commented Jan 6, 2025

FYI, I have worked around this for the time being by parsing the string result: https://github.com/PlaidCloud/databend-sqlalchemy/blob/interval/databend_sqlalchemy/types.py#L88..L109

Yes. The string format is single. We can add same parse logic in bendsql.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants