Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSERT INTO tester VALUES ('08/09/2018 11:13', 'EMP944274823', "T'Challa", '0', "T'Challa ", 'CPY703661946', 'Prostetnic Vogon Jeltz', 'BUY', 'BK18266', 'P514605140', 'Tele Pyschic Helmets', '74', '475', '35150')
- INSERT INTO tester VALUES ('08/09/2018 11:13', 'EMP944274823', "T'Challa", '0', 'T''Challa ', 'CPY703661946', 'Prostetnic Vogon Jeltz', 'BUY', 'BK18266', 'P514605140', 'Tele Pyschic Helmets', '74', '475', '35150')
- quote.replace('"','''')
- quote.replace('"',"'")
- quote.replace('"',"'")
- dbxl = connect(dbname=user_db,user="postgres", password="MY_SECRET",host="XXX.XX.XX.XXX", port=6667)
- cursor = dbxl.cursor()
- with open('/home/postgres/PYSTARTERENV/example.csv', 'rt',encoding="utf8") as csvfile:
- reader = csv.reader(csvfile,quotechar="'")
- for row in reader:
- query = ('INSERT INTO %s VALUES %r' %(table_name,tuple(row)))
- cursor.execute(query)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement