Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import psycopg2
- def importoDB(self):
- self.conn = psycopg2.connect( host='ip', user='username',
- password='pass',
- dbname='dbname')
- self.cursor = self.conn.cursor()
- f = open(r'test.csv', 'r')
- self.cursor.copy_from(f, 'dbname', sep=';')
- f.close()
- self.conn.commit()
Add Comment
Please, Sign In to add comment