verkter
verkter

Reputation: 778

Pandas DataFrame to PostgreSQL using Psycopg2

Is it possible to write a Pandas dataframe to PostgreSQL database using psycopg2?

Endgoal is to be able to write a Pandas dataframe to Amazon RDS PostgreSQL instance.

Upvotes: 7

Views: 11583

Answers (1)

David Maust
David Maust

Reputation: 8270

If you use a SQLAlchemy engine around psycopg2, you could probably use df.to_sql. See: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_sql.html

Upvotes: 2

Related Questions