[DB-SIG] Python-db select
Carsten Haese
carsten at uniqsys.com
Thu Sep 7 16:34:11 CEST 2006
On Thu, 2006-09-07 at 10:07, Andy Dustman wrote:
> On 9/6/06, Nasr Y.M.J.O. <nasr974 at hotmail.com> wrote:
>
> > def get_OSS(self):
> > #grabs the OSS servers from the database
> > line 99 --------> query = 'select nodes.id, nodes.name from nodes where '\
> > 'nodes.membership=%d ' \
> > 'or nodes.membership=%d' \
> > % (self.memberships['Compute-oss'],
> > self.memberships['Lustre-oss'])
> >
> > osslist = []
> > rc = self.rocksdb.execute(query)
>
> Don't do that; you should only use %s placeholders with MySQLdb, and
> you aren't passing your parameters to execute().. Please read the
> documentation, and particularly PEP-249.
Right speech, wrong audience. I gather from the context of the question
that Nasr didn't write this script, he's just a user.
-Carsten
More information about the DB-SIG
mailing list