Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> import psycopg2 as dbapi2
- db
- >>> db = dbapi2.connect(host="schemaverse.com", database="schemaverse", user="rick", password="rick")
- >>> cur = db.cursor()
- >>> cur.execute("SELECT username, balance, fuel_reserve FROM my_player")
- >>> rows = cur.fetchall()
- >>> for i, row in enumerate(rows):
- print "Row", i, "value = ", row
- Row 0 value = ('rick', Decimal('327115483'), 127704078)
- >>> cur.execute("SELECT convert_resource('FUEL', fuel_reserve) from my_player")
- >>> rows = cur.fetchall()
- >>> for i, row in enumerate(rows):
- print "Row", i, "value = ", row
- Row 0 value = (127704078,)
- >>> item = row[0]
- >>> print item
- 127704078
- >>> exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement