DB Pool
Hi, I use MySQLdb lib to access my DB, because I want to opttimize my sql queries. The application I'm working on has quite a few traffic load, so I want to minimize the time of creating/destroying cursors: My typical code is sth like: cursor=con.cursor() cursor.execute(sql) all= cursor.fetchall() cursor.close() So, the question is... how can I minimize this cost? I was thinking on Connection Pools, but I didn't find any good documentation or sample. Any idea? -- http://mail.python.org/mailman/listinfo/python-list
how to replace and string in a "SELECT ... IN ()"
Hi,
I have a BIG problem with the next query:
cursor.execute("""
SELECT titem.object_id, titem.tag_id
FROM tagging_taggeditem titem
WHERE titem.object_id IN (%s)
""",( eid_list))
eid_list is suppossed to be a list of ids = [1,5,9]
How can I make it work?
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
Re: how to replace and string in a "SELECT ... IN ()"
Pardon?
% instead of %s?
It doesn't work... :(
On 26 sep, 12:15, Wojtek Walczak <[EMAIL PROTECTED]> wrote:
> On Fri, 26 Sep 2008 02:32:50 -0700 (PDT), bcurtu wrote:
> > I have a BIG problem with the next query:
>
> > cursor.execute("""
> > SELECT titem.object_id, titem.tag_id
> > FROM tagging_taggeditem titem
> > WHERE titem.object_id IN (%s)
> > """,( eid_list))
>
> ^
> It should rather be '%'.
> HTH.
>
> --
> Regards,
> Wojtek Walczak,http://tosh.pl/gminick/
--
http://mail.python.org/mailman/listinfo/python-list
