Skip to content

BUG: to_sql fails with datetime.time values with sqlite fallback mode  #8341

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

Columns of datetime.time were not yet supported in sqlite fallback mode (as noted in #7567, and do work for sqlalchemy), but it now seems to fail silently with master (instead of raising an error).

Using:

import sqlite3
con = sqlite3.connect(':memory:')
dt = pd.date_range('2014-01-01', periods=10, freq='10h')
df = pd.DataFrame({'date':dt.date, 'time':dt.time})
df.to_sql('test_datetime', con, index=False, if_exists='replace')

gives:

In [37]: pd.read_sql_query('select * from test_datetime', con)
Out[37]: 
Empty DataFrame
Columns: [date, time]
Index: []

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO SQLto_sql, read_sql, read_sql_query

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions