Mysqldb printing sql and params no matter what I do

S

Sells, Fred

I had some code originally that printed the sql and params when I called
the .execute method. I removed it but it still prints. I rebooted and
renamed files and still it prints. I am totally stumped; I tried google
but perhaps didn't use the right search; got a lot of hits but no clues.

I'm using MySQLdb 1.2.2 and python 2.4.4 on XP

here is a snipppet that shows problem.
import MySQLdb
from datetime import *

DBSERVER='localhost'
DBSCHEMA='mds81'
sql = '''SELECT aid from assessments WHERE xmitdate between %s AND %s
LIMIT 9'''


class _record:
def __init__(self, adict):self.__dict__=adict

class CaptainQuery:
def __init__(self, host, schema):
self.Connection = MySQLdb.connect (host=host, db=schema)
self.dictcursor =
self.Connection.cursor(cursorclass=MySQLdb.cursors.DictCursor)
print '----------before execute----------------'
self.dictcursor.execute(sql, (20070201, 20070630) )
print '------------after execute-----------'
records = self.dictcursor.fetchall()
for r in records: print r


Q = CaptainQuery(DBSERVER, DBSCHEMA )

----------------- the output is below---------------------------------

----------before execute----------------
SELECT aid from assessments WHERE xmitdate between %s AND %s LIMIT 9
(20070201, 20070630)
------------after execute-----------
{'aid': 16711L}
{'aid': 16712L}
{'aid': 16713L}
{'aid': 16715L}
{'aid': 16845L}
{'aid': 16849L}
{'aid': 16850L}
{'aid': 16851L}
{'aid': 16852L}

---------------------------------------------------------------------------
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top