Add DateTimeRange support(TSRANGE)
razumeiko opened this issue · 0 comments
razumeiko commented
Hi! Thanks for the plugin!
I found some issue when i was trying to use TSRANGE data type. If you will try to use example from SqlAlchemy docs:
from psycopg2.extras import DateTimeRange
from sqlalchemy.dialects.postgresql import TSRANGE
class RoomBooking(Base):
__tablename__ = 'room_booking'
room = Column(Integer(), primary_key=True)
during = Column(TSRANGE())
booking = RoomBooking(
room=101,
during=DateTimeRange(datetime(2013, 3, 23), None)
)
You will receive error saying "'during' is of type tsrange but expression is of type character varying"
So it's required to explicitly cast the value: during = cast(DateTimeRange(datetime(2013, 3, 23), None), TSRANGE)
.