We have a script that was running comfortably for past 4 years. It pulls a lot of data from a SugarCRM application and then prints some reports.
I am using Python-MySQLDB to pull the data.
db = mdb.connect('localhost', db_user, db_pass, db_name)
c = db.cursor()
statement = "
select a.email_address
, c.hits
, c.activity_date
, c.activity_type
from email_addresses a
, campaign_log c
, email_addr_bean_rel r
where c.target_id = r.bean_id
and r.email_address_id = a.id
and c.activity_type = 'targeted'
and c.campaign_id ='%s'
"%x
c.execute(statement)
rows = c.fetchall()
Problem is the SQL query gets executed both on MySQL shell as well as on phpmyadmin throwing in correct values as results.
But on python shell
>>rows
>>()
Except that the SugarCRM version was updated a few weeks back, and even after post updating things were working fine.
What could be the problem? Is it that new version have some InnoDB tables?
I am stumped. Any guidance would be welcome.
Edit-- I had copied a SQL Query statement which executes correctly on both mysql shell as well as phpmyadmin window, and ran it, and results are the same. It is showing an empty tuple, and no SQL records are available.
I am certain the issue is not because of passing the string, as that is the direction which everyone seems to be suggesting.
%xat the end of your statement?