Re: [Python] how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-25 Thread dmaziuk
D'oh. You're right, of course. Thank you Dima -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python] how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-24 Thread Chris Gonnerman
You're looking at it wrong. It doesn't matter what type of cursor it is, only if you can get the correct number. So use a try...except: try: cursor.execute(""" select last_insert_rowid() """) except: cursor.execute(""" select currval('my_sequence') """) That's

Re: how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-24 Thread dmaziuk
For psycopg2: '' (of course, this could also be due to RHEL5's ancient python). Dima -- http://mail.python.org/mailman/listinfo/python-list

Re: how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-24 Thread MRAB
On 24/01/2011 19:44, dmaziuk wrote: Hi everyone, I've wrapper class around some sql statements and I'm trying to add a method that does: if my_cursor is a sqlite cursor, then run "select last_insert_rowid()" else if it's a psycopg2 cursor, then run "select currval( 'my_sequence' )" etc.

Re: how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-24 Thread Jon Clements
On Jan 24, 7:44 pm, dmaziuk wrote: > Hi everyone, > > I've wrapper class around some sql statements and I'm trying to add a > method that does: >   if my_cursor is a sqlite cursor, then run "select > last_insert_rowid()" >   else if it's a psycopg2 cursor, then run "select > currval( 'my_sequence'

how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-24 Thread dmaziuk
Hi everyone, I've wrapper class around some sql statements and I'm trying to add a method that does: if my_cursor is a sqlite cursor, then run "select last_insert_rowid()" else if it's a psycopg2 cursor, then run "select currval( 'my_sequence' )" etc. The best I can come up with is import bo