On Apr 18, 2012, at 9:36 AM, Will wrote: > The postgresql Time type supports times from "00:00:00" to "24:00:00" in > accordance with ISO 8601. The python datetime.time class does not currently > support "24:00:00" but it would be useful to have SQLAlchemy support that.
puzzled, looking at http://docs.python.org/library/datetime.html#datetime.time: All arguments are optional. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints or longs, in the following ranges: 0 <= hour < 24 0 <= minute < 60 0 <= second < 60 0 <= microsecond < 1000000. ? the coercion of PG's date/time fields into Python objects are a product of psycopg2. If psycopg2 isn't doing what you want here, you'd want to check with that product - psycopg2 has a comprehensive system of modifying it's typing behavior: http://initd.org/psycopg/docs/extensions.html#sql-adaptation-protocol-objects > I'm using SQLAlchemy 0.6.8 and was wondering if there is a way to allow it to > support the "24:00:00" midnight notation. SQLAlchemy doesn't deal with string notations when it talks to Postgresql regarding date and time types. Psycopg2 handles the details of string formatting. > > I've tried to make a custom type that would support it, but it seems that > psycopg2 will return a datetime.time class even if I define the custom type > to implement the Text type. right, this is all psycopg2. You'd need to establish this behavior using psycopg2 only first, by registering adapters as described in the above document. Once you set that up SQLAlchemy just passes that data right through. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
