PyHive
PyHive copied to clipboard
HiveTypeCompiler: Why 'DATE' to 'TIMESTAMP' conversion is needed
Hi
For StrictVersion(sqlalchemy.version) >= StrictVersion('0.6.0'): visit_DATE is returning 'TIMESTAMP'. Shouldn't it be DATE ?
I'm guessing this is because PyHive predates the DATE type, which was added in 0.12. The TIMESTAMP type was added earlier.
Can it be fixed now ?
I just wonder why this is still not fixed.
I would suggest to implement this like the sqlalchemy implementation for SQL Server:
- a new dialect member variable, e.g.
deprecated_date_type, is added which is by defaultFalse/Noneand can be set manually when initializing the dialect - on first connection to the database, the version is read from the server via
SELECT version(). When the version is older than 0.12, thedeprecated_date_typevariable is set toTrue - the type compiler uses the
DATEtype by default and usesTIMESTAMPwhendeprecated_date_typeisTrue.
Here some code snippets from the SQL Server SQLAlchemy implementation:

