On Dec 13, 12:12 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 12 Dec 2007 16:02:35 -0800 (PST), [EMAIL PROTECTED] declaimed > the following in comp.lang.python: > > > > > Thanks Duncan and John! That makes sense. But why does the official > > Python docs show an example that seems to imply that there is a "date" > > type? See link below: > > >http://docs.python.org/lib/node349.html > > You missed two items... The open specified options to use either the > type /name/ declared in the CREATE TABLE or a type name attached to the > field names in a select -- and those are used to /call/ a data converter > function that has to be registered. Key phrases: > > """ > There are default adapters for the date and datetime types in the > datetime module. They will be sent as ISO dates/ISO timestamps to > SQLite. > > The default converters are registered under the name "date" for > datetime.date and under the name "timestamp" for datetime.datetime. > """ > > """ > con = sqlite3.connect(":memory:", > detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) > """ > Note the "detect_types" specification. Also take care, if your > database was populated by some other application that used that > mm/dd/yyyy format, you may have problems as the converters above specity > /sending/ ISO format to the database from Python datetime objects, and > probably expecting to convert them back on input. > -- > Wulfraed Dennis Lee Bieber KD6MOG > [EMAIL PROTECTED] [EMAIL PROTECTED] > HTTP://wlfraed.home.netcom.com/ > (Bestiaria Support Staff: [EMAIL PROTECTED]) > HTTP://www.bestiaria.com/
Well, that makes sense. I read the parts you mentioned earlier, but I guess I just wasn't getting my head around the concepts. Thanks for clearing that up. Mike -- http://mail.python.org/mailman/listinfo/python-list