For those that end up being interested in something like this. For the
complete round robin I did this.
from path.to.time import Time
from psycopg2 import extensions
def cast_time(value, cur):
"""Cast postgresql Time type to a Time object"""
if value is None:
return None
return Time.parse(value)
# 1083 is the oid for postgres Time type
TIME = extensions.new_type((1083,), "TIME", cast_time)
extensions.register_type(TIME)
def adapt_time(value):
"""Adapt value coming in to something postgres can handle."""
return extensions.adapt(str(value))
extensions.register_adapter(Time, adapt_time)
--
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.