If you look at the schema for the "ticket" table you will notice that both "time" and "changetime" fields are stored as integers. Presumably it is the number of seconds since the start of the epoch. What you need to do is find out exactly what the integer values represent and then convert your human dates into corresponding integer time stamps.

If Trac's time stamps are UNIX time stamps then you should be able to convert your dates using something like this:

strftime('%s', '2006-08-11 18:00:00');

So your insert statement would need to be changed to:

INSERT INTO "ticket" VALUES(1, 'defect', strftime('%s', '2006-08-11 18:00:00'), strftime('%s', '2006-08-11 18:06:00'), 'component1', NULL, 'major', 'somebody', 'rnmixon', '', '4.0.11', '', 'closed', 'fixed', 'Ticket Summary (example)', 'Ticket Description (example)', '');

By the way, this is all from my head and looking at his reference page: 


You might want to test all this first :-)

cheers,
tomek

On 16/08/2006, at 6:43 PM, Richard Mixon wrote:

I am trying to import data from another tracking system. Unfortunately my data is (now) in an Excel file which I have exported as CSV and am reformattings as INSERT statements to use with sqlite3.
 
All seems fine, except for dates and timestamps. My "closed" date for example is in a date string like "2006-08-11 18:06:47". I cannot figure out how to import it into sqlite3.
The statement below does not work:
 
INSERT INTO "ticket" VALUES(1, 'defect', '2006-08-11 18:00:00', '2006-08-11 18:06:00', 'component1', NULL, 'major', 'somebody', 'rnmixon', '', '4.0.11', '', 'closed', 'fixed', 'Ticket Summary (example)', 'Ticket Description (example)', '');
I have read the sqlite doc, and tried the datetime functions - but they all seem intent on taking a date that is already in integer format and displaying it.
 
Also, I'm not really Python-literate (yet) - so that may be part of what I am missing.
 
Any suggestions are appreciated. I did search the list archives but did not find what I was looking for
 
_______________________________________________
Trac mailing list

_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac

Reply via email to