Skip to content

Support for SQL INTERVAL Types by mapping to two distinct Python types - #324

Open
padhia wants to merge 3 commits into
mkleehammer:masterfrom
padhia:master
Open

Support for SQL INTERVAL Types by mapping to two distinct Python types#324
padhia wants to merge 3 commits into
mkleehammer:masterfrom
padhia:master

Conversation

@padhia

@padhia padhia commented Jan 5, 2018

Copy link
Copy Markdown

SQL INTERVAL types are classified into two distinct groups -- one that has month as the most granular time period and the other which has microsecond as the most granular time period. Per the SQL standard, it is meaningless to convert from one group of interval types to the other and thus is not permitted.

This PR provides support for these two groups of SQL INTERVAL types by mapping them to Python int (number of months) and datetime.timedelta respectively as their canonical representations.

@mkleehammer

Copy link
Copy Markdown
Owner

Nice job coming up with a reasonable interface: month & microsecond.

Can you add some unit tests for at least SQL Server and PostgreSQL for these before we merge?

@v-chojas

Copy link
Copy Markdown
Contributor

@mkleehammer FYI SQL Server has no interval types.

@bkline bkline mentioned this pull request Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants