On Apr 11, 11:58 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 11 Apr 2007 05:39:21 -0700, "KDawg44" <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > > > ohhh okay. thanks so much. I knew that it came out as strings, i > > guess it makes sense that I would have to send it back IN as a > > string. Changed that and now it works! THanks so much. > > I'd be interested in the schema definition -- my experience has been > that numeric fields come out of MySQLdb as numerics... > > >>> import MySQLdb > >>> cn = MySQLdb.connect(host="localhost", user="BestiariaCP", db="bestiaria") > >>> cr = cn.cursor() > >>> cr.execute("select * from comics where banner is not Null") > 35L > >>> cr.fetchone() > > (2L, 'Anxiety Cafe', 'Anxiety Cafe', > 'http://rockerbot.artistrealm.org/', 'images/ronandrockerbutton.jpg', > 234L, 60L, 'Platitudes from a platypus.', 'On hiatus - site rebuild', > 'N', 'Y') > > > > Note the first field there -- a Python long integer (the schema > defines that as an integer auto_increment field). Also the "234L, 60L," > (image width/height) -- all returned as numeric. > > If your data is coming out as a string, I'd suspect the schema > defined it as a character type. > > >>> cr.description > > (('ID', 3, 2, 11, 11, 0, 0), ('name', 253, 33, 100, 100, 0, 0), > ('sortname', 253, 33, 100, 100, 0, 0), ('URL', 253, 56, 75, 75, 0, 0), > ('banner', 253, 29, 75, 75, 0, 1), ('width', 3, 3, 11, 11, 0, 1), > ('height', 3, 3, 11, 11, 0, 1), ('description', 252, 170, 65535, 65535, > 0, 0), ('occurs', 253, 58, 125, 125, 0, 1), ('isactive', 254, 1, 1, 1, > 0, 0), ('isonline', 254, 1, 1, 1, 0, 0)) > > > > CREATE TABLE `comics` ( > `ID` int(11) NOT NULL auto_increment, > `name` varchar(100) NOT NULL default '', > `sortname` varchar(100) NOT NULL default '', > `URL` varchar(75) NOT NULL default '', > `banner` varchar(75) default NULL, > `width` int(11) default NULL, > `height` int(11) default NULL, > `description` text NOT NULL, > `occurs` varchar(125) default NULL, > `isactive` enum('N','Y') NOT NULL default 'Y', > `isonline` enum('N','Y') NOT NULL default 'Y', > PRIMARY KEY (`ID`), > KEY `namesort` (`sortname`) > ) ENGINE=MyISAM AUTO_INCREMENT=92 DEFAULT CHARSET=latin1; > -- > Wulfraed Dennis Lee Bieber KD6MOG > [EMAIL PROTECTED] [EMAIL PROTECTED] > HTTP://wlfraed.home.netcom.com/ > (Bestiaria Support Staff: [EMAIL PROTECTED]) > HTTP://www.bestiaria.com/
I see your point. Somewhere in my head I must have mixed them up. It goes in as a string but comes out as whatever data type. Thanks. -- http://mail.python.org/mailman/listinfo/python-list