Skip to content

getting sqlalchemy datetime type ignores None timezones #9691

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

Closed
mangecoeur opened this issue Mar 20, 2015 · 3 comments
Closed

getting sqlalchemy datetime type ignores None timezones #9691

mangecoeur opened this issue Mar 20, 2015 · 3 comments
Labels
Duplicate Report Duplicate issue or pull request IO SQL to_sql, read_sql, read_sql_query

Comments

@mangecoeur
Copy link
Contributor

When converting to datetime64, pandas does:

        if col_type == 'datetime64': 
            try:
                tz = col.tzinfo
                return DateTime(timezone=True)
            except:
                return DateTime
        if col_type == 'timedelta64':

2 problems

  1. The exception catch is way to broad. I think this was probably supposed to catch an AttributeException (For col with no tzinfo attribute at all)
  2. columns can have a tzinfo =None, in which case a Datetime(timezone=False) should be created instead.
@jorisvandenbossche
Copy link
Member

Did you have an issue with this with an actual case? Because I don't think this code is working at all, as columns (series) have never a tzinfo attribute.

I also mentioned this in #9086, the issue for timezone support in the sql functions.

@mangecoeur
Copy link
Contributor Author

This didn't trigger an actual bug, its more that i was looking through other issues and i noticed this bit of code didnt make sense....

@jorisvandenbossche
Copy link
Member

It indeed does not make much sense ..
I am going to close this, as there is already #9086 to track this.

@jorisvandenbossche jorisvandenbossche added this to the No action milestone Mar 25, 2015
@jorisvandenbossche jorisvandenbossche added IO SQL to_sql, read_sql, read_sql_query Duplicate Report Duplicate issue or pull request labels Mar 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request IO SQL to_sql, read_sql, read_sql_query
Projects
None yet
Development

No branches or pull requests

2 participants