Re: [Tutor] MySQLdb: cant get '... where field in %s' to work

2006-06-26 Thread Alan Gauld
>>> ARTICLES = ('XXX9', 'ABZ2') >>> TESTARTICLENAME = """SELECT * FROM tblForTransfer2Prodsite >>> WHERE articleName IN %r""" % (ARTICLES,) This uses normal string substitution so puts the tuple ARTICLES in the query using the repr format - includes parens) which is what you want. (BTW us

Re: [Tutor] MySQLdb: cant get '... where field in %s' to work

2006-06-25 Thread Justin Ezequiel
I wrote: >> ARTICLES = ('XXX9', 'ABZ2') >> TESTARTICLENAME = """SELECT * FROM tblForTransfer2Prodsite >> WHERE articleName IN %r""" % (ARTICLES,) >> SQLARTICLENAME = """SELECT * FROM tblForTransfer2Prodsite >> WHERE articleName IN %s""" >> >> print cur.execute(TESTARTICLENAME), >>

Re: [Tutor] MySQLdb: cant get '... where field in %s' to work for string sequences

2006-06-23 Thread Matt Richardson
On 6/22/06, Justin Ezequiel <[EMAIL PROTECTED]> wrote: > how can I get 'select ... from ... where field in %s' to work for > sequences of strings? > sequences of integers works just fine > > import MySQLdb > > DBCRED = {'host': 'localhost', 'user': 'userjustin', > 'passwd': 'passwdjustin'

[Tutor] MySQLdb: cant get '... where field in %s' to work for string sequences

2006-06-22 Thread Justin Ezequiel
how can I get 'select ... from ... where field in %s' to work for sequences of strings? sequences of integers works just fine import MySQLdb DBCRED = {'host': 'localhost', 'user': 'userjustin', 'passwd': 'passwdjustin', 'db': 'dbjustin'} ARTICLES = ('XXX9', 'ABZ2') PIDS = (2937