Advertisement
Mushi

postgre query generator

Jan 25th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. text_file = open("x.txt", "r")
  2.  
  3. with open("x.sql", "a") as f:
  4.     for line in text_file:
  5.         b = line.split(";")
  6.         text = b[1]
  7.         sys = b[2].replace("'", "")[1:-2]
  8.         print("INSERT INTO \"public\".\"x\" VALUES ( default, '{}', '{}' );".format(text, sys), file=f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement