Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. >>> import psycopg2 as dbapi2
  2. db
  3. >>> db = dbapi2.connect(host="schemaverse.com", database="schemaverse", user="rick", password="rick")
  4. >>> cur = db.cursor()
  5. >>> cur.execute("SELECT username, balance, fuel_reserve FROM my_player")
  6. >>> rows = cur.fetchall()
  7. >>> for i, row in enumerate(rows):
  8. print "Row", i, "value = ", row
  9.  
  10. Row 0 value = ('rick', Decimal('327115483'), 127704078)
  11. >>> cur.execute("SELECT convert_resource('FUEL', fuel_reserve) from my_player")
  12. >>> rows = cur.fetchall()
  13. >>> for i, row in enumerate(rows):
  14. print "Row", i, "value = ", row
  15.  
  16. Row 0 value = (127704078,)
  17. >>> item = row[0]
  18. >>> print item
  19. 127704078
  20. >>> exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement