trying to understand the subtleties of inserting data into a mysql tbl when dealing with unix_timestamp, and the timestamp def within the tbl
using python v2.6, using the mysqldb lib
i'm consistently getting the err/warning: TypeError: not all arguments converted during string formatting
the test tbl looks like:
DROP TABLE IF EXISTS `functionError_TBL`;
CREATE TABLE `functionError_TBL` (
`parentFunction` varchar(100) NOT NULL default '',
`currentFunction` varchar(100) NOT NULL default '',
`parentFunctionID` int(10) NOT NULL default 0,
`errorStatus` int(1) NOT NULL default 0,
`clientServerUUID` varchar(100) NOT NULL default '',
`processTime` timestamp NOT NULL default 0,
`CollegeID` int(10) NOT NULL default 0,
`CrawlID` varchar(200) NOT NULL default '',
`CollegeName` varchar(200) NOT NULL default '',
`CollegeAbbrv` varchar(200) NOT NULL default '',
.
.
the test script looks like . . tlist= [(1, 1281502771, 1)]
ins="insert into functionError_TBL "
ins=ins+"(errorStatus,processTime, CollegeID)"
ins=ins+" values "
ins=ins+" (%s,from_unixtime(%s), %s)"
db.executemany (ins, tlist)
i can insert a single val (either the time, or the int) with no issue, inserting multiple vals that include the timeval generates the error... testing has indicated that i can have multiple fields that don't include the time, which work as well... so the issue really appears to point to the "from_unixtime" conversion within the paramaterization process.
removing the "from_unixtime, generates another type of err, " Warning: Data truncated.. " due to the timestamp. i really would like to understand what's going on here..
thoughts on how to resolve this would be greatly appreciated.
thanks
***UPDATE::::: after more testing, it appears that something is happening with the parameter process.. if I change everything, to have the parameter process have the "from_unixtime(%s) at the end of the parameter placeholders.. and change the insert fields/data correspondingly, everything works...
so the issue is what/how does the "from_unixtime(%s)" have to be wrapped to work when it's used in a separate location within the placeholder portion of the insert...
thanks