Last active
November 22, 2020 21:13
-
-
Save vvaezian/86c048921248174398bdc3a1a804f76c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
connection = psycopg2.connect(user="USER" | |
, password="PASSWORD" | |
, port="5432" | |
, database="DB_NAME" | |
, host="HOST") | |
cursor = connection.cursor() | |
with open('ratings.tsv') as f: | |
f.readline() | |
cursor.copy_from(f, 'source_ratings') | |
connection.commit() | |
with open('episodes.tsv') as f: | |
f.readline() | |
cursor.copy_from(f, 'source_episodes') | |
connection.commit() | |
with open('basics.tsv', 'rb') as f: | |
f.readline() | |
cursor.copy_from(f, 'source_basics') | |
connection.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment