PaulPaulAga

Untitled

Apr 16th, 2021
1,974
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. import psycopg2
  2.  
  3. f = open("videos.txt")
  4.  
  5. conn = psycopg2.connect(dbname='netflix', user='redtech',
  6.                         password='red_tech', host='localhost')
  7. c = conn.cursor()
  8. for line in f:
  9.     address, name, id = line.split(";")
  10.     name = name.strip("\n")
  11.     id = int(id)
  12.     print(address, id)
  13.     try:
  14.         cursor.execute("update movie_videos set path = %s where movie_id = %s;", [address, id])
  15.     except:
  16.         print("SUKAAAA")
  17. c.close()
  18. conn.commit()
  19. conn.close()
Advertisement
Add Comment
Please, Sign In to add comment