Re: [BangPypers] help using mysqldb

2008-12-24 Thread Vijay Ramachandran
On Thu, Dec 18, 2008 at 11:31 AM, wrote: > From: "Sidharth Kuruvila" > > Do this instead > > cur.execute('select * from Employee where id in (%s)', ids.join(', ')); > > I would need to co-erce my id into a string rep to do this. I guess that's ok? Also, will the escaping be taken care of if the

Re: [BangPypers] help using mysqldb

2008-12-24 Thread Vijay Ramachandran
On Thu, Dec 18, 2008 at 11:31 AM, wrote: > From: Jeff Rush > You may find the bit of additional software at the following site useful. > It > has a slide presentation that talks about this and similar issues and > delivers > a lightweight solution. > >http://furius.ca/antiorm/ > > The prese

Re: [BangPypers] help using mysqldb

2008-12-17 Thread Jeff Rush
Vijay Ramachandran wrote: > > Suppose I have a list of ids, I would write sql such as > 'select * from Employee where id in (id1, id2, id3)' and this would work > even if there was only one id, say, 'select * from Employee where id in > (id1)' > > How should I do this in MySQLdb? It seems that I

Re: [BangPypers] help using mysqldb

2008-12-17 Thread Sidharth Kuruvila
Do this instead cur.execute('select * from Employee where id in (%s)', ids.join(', ')); On Wed, Dec 17, 2008 at 5:13 PM, Vijay Ramachandran wrote: > Hello. > > I'm unable to figure out how to use mysqldb (actually, dbabi) to write an > "in" query. > > For instance, suppose my table looks like th

[BangPypers] help using mysqldb

2008-12-17 Thread Vijay Ramachandran
Hello. I'm unable to figure out how to use mysqldb (actually, dbabi) to write an "in" query. For instance, suppose my table looks like this: Employee( id int not null primary key, name varchar(32) not null) ); Suppose I have a list of ids, I would write sql such as 'select * from Employee wher