Advertisement
Guest User

Untitled

a guest
Oct 9th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from qgis.PyQt.QtXml import QDomDocument
  4. from qgis.utils import iface
  5. import psycopg2
  6.  
  7.  
  8.  
  9. constring = u"dbname='database' host='postgre' port='port' user='username' password='code'"
  10. conn=psycopg2.connect(constring)
  11. checkCur = conn.cursor()
  12. sqlCheck = "select * from public.mytable;"
  13. checkCur.execute(sqlCheck)
  14. sqlCheckRess = checkCur.fetchall()
  15.  
  16. mylist=[]
  17.  
  18. for i in sqlCheckRess :
  19.     mylist.append(i)
  20. checkCur.close()
  21. conn.close()
  22. print mylist
  23.  
  24. u'2247_u03a5u06c6u03b9u04c3u03c4u03acu05bcu03b5u03bdu03bf u03c5u03c0u03ccu03b2u03b1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement