Using PgSQLDatabase.to_sql() in python 3 returns an error (TypeError: a bytes-like object is required, not 'str').
A simple work-around (but perhaps not the best solution?) is create the csv in memory and convert it to a bytes object before passing to stdin for the COPY, that is:
Description
Using
PgSQLDatabase.to_sql()
in python 3 returns an error (TypeError: a bytes-like object is required, not 'str'
).A simple work-around (but perhaps not the best solution?) is create the csv in memory and convert it to a bytes object before passing to stdin for the COPY, that is:
instead of:
at util.py line 456, but there may be a more efficient solution and should confirm this will work in python 2 as well.
What I Did