Skip to content

Bug with sql.write_frame - not possible to write Dataframe to SQLite DB #6015

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
jphme opened this issue Jan 20, 2014 · 2 comments
Closed

Bug with sql.write_frame - not possible to write Dataframe to SQLite DB #6015

jphme opened this issue Jan 20, 2014 · 2 comments
Labels
IO SQL to_sql, read_sql, read_sql_query
Milestone

Comments

@jphme
Copy link

jphme commented Jan 20, 2014

Additionally to the broken replace option ( #4110 ) the sql.write_frame function does not work anymore for me with 0.13 when trying to write a Dataframe into a SQLite DB:

sql.write_frame(frame, name=name, con=conn, if_exists='replace')

results in :

  File "/usr/local/lib/python2.7/dist-packages/pandas/io/sql.py", line 228, in write_frame
    func(frame, name, safe_names, cur)
  File "/usr/local/lib/python2.7/dist-packages/pandas/io/sql.py", line 244, in _write_sqlite
    cur.executemany(insert_query, data)
sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.

The same code did work before without issues.

EDIT: I solved the problem by adding:

frame['index']=frame['index'].astype(long)

The index column was stored as datetime64 dtype before. Still don't know why my code broke, before it worked without type conversion.

@jreback
Copy link
Contributor

jreback commented Jan 25, 2014

cc @hayd
cc @mangecoeur

keep open or is this covered already?

@mangecoeur
Copy link
Contributor

@jreback this should be closed - related to limited datetime support in sqlite. should be fixed in the new sql module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO SQL to_sql, read_sql, read_sql_query
Projects
None yet
Development

No branches or pull requests

3 participants