fix!: Add DATETIMEOFFSET handling in pyodbc for MSSQL#4930
Merged
erindru merged 4 commits intoSQLMesh:mainfrom Jul 9, 2025
Merged
fix!: Add DATETIMEOFFSET handling in pyodbc for MSSQL#4930erindru merged 4 commits intoSQLMesh:mainfrom
erindru merged 4 commits intoSQLMesh:mainfrom
Conversation
fe30ea2 to
a637f37
Compare
erindru
reviewed
Jul 8, 2025
4ec0b84 to
7ed0734
Compare
Contributor
Author
|
@erindru hm, the tests fails when I run them on the main branch as well. |
Contributor
|
@mattiasthalen try rebasing off of main, @themisvaltinos fixed CI. |
5affaba to
0c169be
Compare
georgesittas
approved these changes
Jul 8, 2025
Contributor
georgesittas
left a comment
There was a problem hiding this comment.
This looks reasonable to me, @mattiasthalen.
Just double-checking, but this is backwards-compatible, yes? In the sense that DATETIMEOFFSET would previously lead to an error, if pyodbc was used?
Contributor
Author
|
Yes, without it PYODBC would throw an error about data type -155 |
erindru
reviewed
Jul 8, 2025
0c169be to
6043490
Compare
georgesittas
approved these changes
Jul 9, 2025
Contributor
georgesittas
left a comment
There was a problem hiding this comment.
I'll mark this as breaking due to the version constraint.
a7e6a20 to
fab2de4
Compare
erindru
reviewed
Jul 9, 2025
fab2de4 to
774b6b3
Compare
erindru
approved these changes
Jul 9, 2025
Collaborator
erindru
left a comment
There was a problem hiding this comment.
Great work, thanks!
This ended up in a much simpler place than where we started
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces enhancements to MSSQL connection handling, particularly for the
pyodbcdriver, and updates dependency specifications forpyodbcacross the project. The most significant changes include adding support for MSSQL'sDATETIMEOFFSETtype, improving test coverage for this feature, and ensuring thepyodbcversion is explicitly specified to avoid compatibility issues.MSSQL Connection Enhancements:
sqlmesh/core/config/connection.py: Added support for MSSQL'sDATETIMEOFFSETtype by implementing a custom output converter at the connection level forpyodbc. The converter handles binary data for theDATETIMEOFFSETSQL type (-155) and converts it into Python'sdatetimeobjects with timezone information.Test Coverage Improvements:
tests/core/test_connection_config.py: Added tests to validate theDATETIMEOFFSEThandling forpyodbc. These include scenarios for positive and negative timezone offsets, ensuring proper conversion of binary data todatetimeobjects. Additionally, confirmed that_cursor_initis no longer required forpymssqldue to the connection-level setup.Dependency Updates:
pyproject.toml: Updated thepyodbcdependency to require version>=5.0.0across multiple optional dependency groups (azuresql-odbc,mssql-odbc, anddev) to ensure compatibility with the new features. [1] [2] [3]