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

Add 'datetime64[ms]': types.DATETIME to _type_map in query.py #44

Open
jocowhite opened this issue Feb 5, 2024 · 2 comments · May be fixed by #45
Open

Add 'datetime64[ms]': types.DATETIME to _type_map in query.py #44

jocowhite opened this issue Feb 5, 2024 · 2 comments · May be fixed by #45

Comments

@jocowhite
Copy link

I'm having a project that is using 'datetime64[ms]' instead of 'datetime64[ns]' so it would be great to add that to the _type_map in query.py in the repo.

https://github.com/narendrans/sqlalchemy_dremio/blame/9cf16392ee0e9ca18f241c7d8f2854d9b099162e/sqlalchemy_dremio/query.py#L31

@dacopan dacopan linked a pull request Apr 22, 2024 that will close this issue
@kenho811
Copy link

I have a similar request.

I also added my comment here: #45 (comment)

@wobu
Copy link

wobu commented Feb 5, 2025

if it helps, you could monkey patch the type mapping via:

from sqlalchemy import types
from sqlalchemy.engine import Engine, Inspector
from sqlalchemy.sql.sqltypes import STRINGTYPE

from sqlalchemy_dremio import flight

# SqlAlchemy < 2.0 doesn't have a DOUBLE type, but using Float here would be misleading and can be dangerous for the openmetadata users
class DOUBLE(types.Float):
    __visit_name__ = "DOUBLE"


# monkey patching the sql types of sqlalchemy_dremio package
flight._type_map.update({
    'double': DOUBLE,
    'DOUBLE': DOUBLE,
    'CHARACTER VARYING': STRINGTYPE,
    'BINARY VARYING': types.LargeBinary,
})

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