-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: add support for writing datetime.date and datetime.time columns using to_sql #6932
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
|
@jreback Is there any way to detect the 'real' type of a column when it has dtype BTW, this line now in the codebase: https://github.com/pydata/pandas/blob/master/pandas/io/sql.py#L655 I suppose is useless, as the dtype of a dataframe column can never be |
yes that line would never be true and is useless lib.infer_dtype(com._ensure_object(arr)) would return 'date' or 'time' if all elements are date or time |
I updated this issue to also remember that So adding
|
@JohnSmizz I created a PR to fix this issue, see #8090. |
Sure can do but will not be able to until mid september
|
OK, that would be very welcome |
Hi-
the following commands throw a DataError --
throws the following error:
I have two columns, one with datetime.date and one with datetime.time, which both exhibited this problem. I force-converted the datetime.date column via pd.to_datetime into a datetimeindex, which to_sql/sqlalchemy correctly formats into an SQL-acceptable date format. However, to_datetime does not work on datetime.date, leaving the pandas datatype as "object" instead of datetime64ns.
Thanks,
The text was updated successfully, but these errors were encountered: