with db.cursor(mdb.DictCursor) as dbc:
with db.cursor(mdb.DictCursor) as old_dbc:
#get id, filenames from creatives table
dbc.execute('SELECT id,filename from creatives')
#this does not execute on old_db's database 'mailing' instead it incorrectly uses db's database 'kidon_mailing' old_dbc.execute('SELECT id,filename from creatives')
Platform: Centos 6.3, Mysql server 5.5.25, Oursql 0.9.2, python 2.6
Code: connect( host=host, user='feederapp ',db=db, autoreconnect= True,autoping= True) mdb.connect( host=host, user='feederapp ',db=old_ db, autoreconnect= True,autoping= True)
db=mdb.
old_db=
with db.cursor( mdb.DictCursor) as dbc: mdb.DictCursor) as old_dbc: 'SELECT id,filename from creatives')
old_dbc. execute( 'SELECT id,filename from creatives')
with db.cursor(
#get id, filenames from creatives table
dbc.execute(
#this does not execute on old_db's database 'mailing' instead it incorrectly uses db's database 'kidon_mailing'
Output: 50d642fd7b260ad 02d.jpg' 0d537c9ac38cea1 233.jpg'
dbc.execute('SELECT id,filename from creatives') correctly returns:
'2', 'a7be4ffdcca8e5
'3', '80946164dbc8da
While old_dbc. execute( 'SELECT id,filename from creatives') incorrectly returns: 50d642fd7b260ad 02d.jpg' 0d537c9ac38cea1 233.jpg' 900116ca0fd5350 c3d.jpg' '69219255d4d46d 23ee5bac5aca659 d3f.gif' '
'2', 'a7be4ffdcca8e5
'3', '80946164dbc8da
Instead of:
'1094', 'eef47e724fb74e
'1095',
Mysql schema's:
Database 'mailing'
CREATE TABLE `creatives` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`offer_id` int(11) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`filename` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
`thumb_filename` varchar(255) NOT NULL,
`thumb_url` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `offer_id` (`offer_id`),
CONSTRAINT `creatives_ibfk_1` FOREIGN KEY (`offer_id`) REFERENCES `offers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2281 DEFAULT CHARSET=utf8$$
Table content: 900116ca0fd5350 c3d.jpg' , '/images/ eef47e724fb74e9 00116ca0fd5350c 3d.jpg' , 'thumb- eef47e724fb74e9 00116ca0fd5350c 3d.jpg' , '/images/ thumb-eef47e724 fb74e900116ca0f d5350c3d. jpg', '2012-08-06 14:49:08' 23ee5bac5aca659 d3f.gif' , '/images/ 69219255d4d46d2 3ee5bac5aca659d 3f.gif' , 'thumb- 69219255d4d46d2 3ee5bac5aca659d 3f.gif' , '/images/ thumb-69219255d 4d46d23ee5bac5a ca659d3f. gif', '2012-08-06 14:51:34'
'1094', '318', NULL, 'eef47e724fb74e
'1095', '319', NULL, '69219255d4d46d
Database 'kidon_mailing':
CREATE TABLE `creatives` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`offer_id` int(11) NOT NULL,
`description` varchar(255) DEFAULT NULL,
`filename` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL,
`thumb_filename` varchar(255) NOT NULL,
`thumb_url` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `offer_id` (`offer_id`),
CONSTRAINT `creatives_ibfk_1` FOREIGN KEY (`offer_id`) REFERENCES `offers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2281 DEFAULT CHARSET=utf8$$
Table Content: 50d642fd7b260ad 02d.jpg' , '/static/ images/ a7be4ffdcca8e55 0d642fd7b260ad0 2d.jpg' , 'thumb- a7be4ffdcca8e55 0d642fd7b260ad0 2d.jpg' , '/static/ images/ thumb-a7be4ffdc ca8e550d642fd7b 260ad02d. jpg', '2013-07-14 17:14:56' 0d537c9ac38cea1 233.jpg' , '/static/ images/ 80946164dbc8da0 d537c9ac38cea12 33.jpg' , 'thumb- 80946164dbc8da0 d537c9ac38cea12 33.jpg' , '/static/ images/ thumb-80946164d bc8da0d537c9ac3 8cea1233. jpg', '2013-07-14 17:15:09'
'2', '1', NULL, 'a7be4ffdcca8e5
'3', '1', NULL, '80946164dbc8da