Get cursor : PostgreSQL : Database PYTHON TUTORIALS


PYTHON TUTORIALS » Database » PostgreSQL »

 

Get cursor


import psycopg
dbh = psycopg.connect('dbname=dbname user=username')
print "Connection successful."

cur = dbh.cursor()
cur.execute("SELECT * FROM myTable")
cur.fetchone()
    
print "Obtained %d rows" % cur.rowcount

dbh.close()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Database
» PostgreSQL