Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import psycopg2
- connect = psycopg2.connect(database='test_base',
- user='test_user',
- host='localhost',
- password='test_password')
- cursor = connect.cursor()
- #cursor.execute("CREATE TABLE tbl(id INT, data JSON)")
- #connect.commit()
- #sql ="INSERT INTO tbl(data) VALUES (%s);"
- #cursor.execute("INSERT INTO tbl(data) VALUES (%s);", ('{"1" : "a"}', ))
- #connect.commit()
- cursor.execute("SELECT * FROM tbl;")
- for row in cursor:
- print(row)
- connect.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement