Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. import pandas as pd
  2. import psycopg2
  3. from sqlalchemy import create_engine
  4.  
  5. df = pd.read_csv('products.csv', sep=';', low_memory=False)
  6. engine = create_engine('postgresql://myuser:mypass@server/postgres')
  7. df.to_sql('new_table', con=engine, if_exists='append', index=False, chunksize=20000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement