471,326 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,326 software developers and data experts.

Mysqldb printing sql and params no matter what I do

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 *

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


----------------- 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
Oct 2 '07 #1
0 984

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Dave Harrison | last post: by
1 post views Thread by Peter Nikolaidis | last post: by
reply views Thread by Holger Joukl | last post: by
1 post views Thread by Steve | last post: by
1 post views Thread by Yi Xing | last post: by
2 posts views Thread by Nikhil | last post: by
8 posts views Thread by martinnorth | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.