473,224 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 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 1076

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Dave Harrison | last post by:
Hi all, got a problem combinging mx and MySQLdb, when I build and install both for my Python2.1 install on a Solaris 9 box I can import mx fine, but importing MySQLdb causing python to core dump. ...
by: Peter Nikolaidis | last post by:
Greetings, I am attempting to get MySQLdb 0.9.2 installed on Mac OS 10.2 with a Fink distribution of Python 2.2.2. I have seen only a few posts on the subject, some of them relate to...
by: Richard Shea | last post by:
Hi - I've writing a Python script which has a query which looks like this ... select * from T where C1 not in (1,2,3) .... C1 is a numeric column so elements of (1,2,3) must not be quoted...
by: Holger Joukl | last post by:
You could use the str() builtin, returning the string representation of the list object: >>> params = (1, 2, 3) >>> "select * from T where C1 not in %s" % str(params) 'select * from T where C1...
by: Steve | last post by:
Darwin steve.local 8.3.0 Darwin Kernel Version 8.3.0: Mon Oct 3 20:04:04 PDT 2005; root:xnu-792.6.22.obj~2/RELEASE_PPC Power Macintosh powerpc MacOSX 10.4.3 mysql Ver 14.7 Distrib 4.1.14, for...
by: Bernard Lebel | last post by:
Hello, I'm stumbled at a serious problem, and quite frankly getting desparate. This is a rather long-winded one so I'll try to get straight to the point. I have this Python program, that...
by: Yi Xing | last post by:
Hi, I met the following error when I tried to install MySQLdb. I had no problem installing numarray, Numeric, Rpy, etc. Does anyone know what's the problem? Thanks! running install running...
by: Nikhil | last post by:
I am using the MySQLdb python module. I have a table named 'testing' with few columns, under the 'test' database, what is hosted on a remote mysql server. I want to run the following query to...
by: martinnorth | last post by:
Hi, I am running Python and MySQL on Ubuntu and have installed MySQLdb. If I try to import MySQLdb I get the following error: ActivePython (ActiveState Software Inc.) based on Python...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.