Guest User

Untitled

a guest
Jan 14th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. bbpf=# create table foo(blah numeric);
  2. CREATE TABLE
  3. bbpf=# insert into foo(blah) values ('45.241654897');
  4. INSERT 0 1
  5. bbpf=# insert into foo(blah) values ('4445.25541654897');
  6. INSERT 0 1
  7. bbpf=#
  8.  
  9. >>> import psycopg2
  10. >>> a=psycopg2.connect('host=127.0.0.1 dbname=bbpf user=jcigar password=xxxx')
  11. >>> a
  12. <connection object at 0x801196320; dsn: 'host=127.0.0.1 dbname=bbpf user=jcigar password=xxxxxxxxx', closed: 0>
  13. >>> curs = a.cursor()
  14. >>> curs.execute('select * from foo')
  15. >>> curs.fetchall()
  16. [(Decimal('45.241654897'),), (Decimal('4445.25541654897'),)]
  17. >>>
Add Comment
Please, Sign In to add comment