On Tue, Feb 01, 2011 at 12:26:34PM -0500, Ben Timby wrote: > I really need to store date/time values with millisecond resolution. > What would be the easiest way to achieve this? I found the following > patch: > > http://permalink.gmane.org/gmane.comp.python.sqlobject/5106 > > But I am loath to apply a patch to SQLObject since my code must be portable.
You couldn't apply it anyway - it's too old. > Must I create my own column type? Is there any way to override the > storage method of DateTimeCol? I tried passing a datetimeFormat to the > DateTimeCol.__init__() but this did not have the desired effect. I am > assuming the TIMESTAMP data type of sqlite does not support this level > of resolution? If so, I suppose I must store the date as a string in > ISO 8601 format? You don't understand all subtle details of SQLObject (which is ok). The architecture works this way: to convert data to an SQL string column validator's .from_python() method is called, and whatever it returns (including a simple string) is passed to converters (see converters.py). If you want to override datetime converter for all datetime columns - just register your own converter: def DateTimeConverter(value, db): return "'%s'" % value.isoformat registerConverter(datetime.datetime, DateTimeConverter) Oleg. -- Oleg Broytman http://phdru.name/ p...@phdru.name Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss