-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: full SQL support for datetime64 values #7103
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
Comments
I suppose we can solve this by creating a custom
And the use this in
@jreback There are both |
@jorisvandenbossche hmm, they are virtually the same (one is on the shadow class I think |
however, if we would pick one, I think the name |
ok, sure (and maybe thats why their are 2)! |
See the tests I added for datetime, NaT and NaN values in PRs #7082 and #7100.
Postrgresql (psycopg2)
SQLite
read_sql_table
, and you get strings withread_sql_query
(sqlite has no native datetime format -> nothing to do about that)MySQL (pymysql / MySQLdb / mysql.connector)
pymysql
: fails with "KeyError: < class 'pandas.tslib.Timestamp' >"MySQLdb
: worksmysql.connector
: fails with "ProgrammingError: Failed processing pyformat-parameters; Python 'timestamp' cannot be converted to a MySQL type" or with " 'MySQLConverter' object has no attribute '_timestamp_to_mysql' " (see 'MySQLConverter' object has no attribute '_timestamp_to_mysql' error with datetime64[ns], MySQL and MySQL-connector #7936 for more details)The data are feeded to the database using
df.itertuples()
and thennp.asscalar()
, and this gives data of theTimestamp
class. And for some reason most drivers can handle this (because it is a subclass of datetime.datetime?), but pymysql and mysql.connector not.For now, all the tests are skipped for MySQL / pymysql.
Oracle / SQL Server ?
There are also some issues with NaT handling (see the tests I added for datetime, NaT and NaN values in PRs #7082 and #7100), but to track this there is also an issue specific on NaN handling (#2754)
The text was updated successfully, but these errors were encountered: