Advertisement
Guest User

Untitled

a guest
Dec 28th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. con = psycopg2.connect(dbname=dbname, host=host, port=port, user=user, password=password)
  2. cur = con.cursor()
  3.  
  4. try3 = "TRUNCATE TABLE (%s);"
  5. values = ("schema_one.tbl_six",)
  6. cur.execute(try3,values)
  7.  
  8. try4 = "TRUNCATE TABLE %s;"
  9. values = ("schema_four.tbl_four",)
  10. cur.execute(try4,values)
  11.  
  12. $ ./test_qry.py
  13. Traceback (most recent call last):
  14. File "./test_qry.py", line 23, in <module>
  15. cur.execute(try3,values)
  16. psycopg2.ProgrammingError: syntax error at or near "("
  17. LINE 1: TRUNCATE TABLE ('schema_one.tbl_six');
  18.  
  19. $ ./test_qry.py
  20. Traceback (most recent call last):
  21. File "./test_qry.py", line 28, in <module>
  22. cur.execute(try4,values)
  23. psycopg2.ProgrammingError: syntax error at or near "'schema_four.tbl_four'"
  24. LINE 1: TRUNCATE TABLE 'schema_four.tbl_four';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement