[okfn-help] vdm: strange behavior

Martijn Faassen faassen at startifact.com
Tue Sep 7 18:56:16 UTC 2010


Hi there,

On Tue, Sep 7, 2010 at 7:56 PM, Rufus Pollock <rufus.pollock at okfn.org> wrote:
>> It might be that the exact table structure we create depends on the
>> database system in use; PostgreSQL could use DateTime and MySQL could
>> use a float. This might lead to hard to understand code however.
>> Alternatively we could translate the float column back to DateTime
>> objects on the fly, with a read-only property. But it would still make
>> direct queries of the revision table more difficult.
>
> You could implement this at a lower level in sqlalchemy, i.e. by
> creating a custom type. In many ways if we are going to support mysql
> (despite it's poor timestamp behaviour) I would like to special case
> it where possible and not disturb the existing db structure (for
> psql/sqlite etc) -- even if this is a bit ugly!

I'm not sure I'm not reading this out of order, but I've reported
already a while ago that I created a special type for SQLAlchemy that
stores a higher-precision datetime as a decimal.

I think this is the right way to go, as at least at the developer
level the behavior of that column will be the same as for postgresql,
as long as the SQLAlchemy APIs are used.

Regards,

Martijn




More information about the okfn-help mailing list