>>> 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
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),
>>
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'
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