sqlite weirdness
kyosohma at gmail.com
kyosohma at gmail.com
Thu Dec 13 09:02:19 EST 2007
On Dec 13, 12:12 am, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Wed, 12 Dec 2007 16:02:35 -0800 (PST), kyoso... at gmail.com 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
> wlfr... at ix.netcom.com wulfr... at bestiaria.com
> HTTP://wlfraed.home.netcom.com/
> (Bestiaria Support Staff: web-a... at bestiaria.com)
> 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
More information about the Python-list
mailing list