Hi,

I am using psycopg2 and trying to put together a new daterange type that 
combines the following:

1. A custom daterange class which provides various useful helpers 
(backwards/forwards iteration, intersection).
2. The psycopg2 DateRange that fills in with some helpers of its own 
(contains, comparisons) and takes care of marshaling the object from/to the 
db
3. The DATERANGE sqlalchemy/postgres type to take care of emiting of SQL 
operators and DDL, and so that I can use it both when querying and when 
declaring Columns()

So my naive approach is the following, going by the guideline at 
http://docs.sqlalchemy.org/en/latest/core/compiler.html#subclassing-guidelines:

from psycopg2.extras import DateRange
from sqlalchemy.dialects.postgresql import DATERANGE

class MyDateRange(TypeDecorator, DateRange):

  impl = DATERANGE

  def intersection():
      #...


This crashes when emitting a table.create() statement.

When I look at the documentation on how to create/modify types I am left 
dumfounded and I realize I would need a significant trial and error 
investment to figure out how things work. Does anyone else have experience 
with such an attempt? I'd rather not  become an expert in sqlalchemy type 
extension before I can make this work.

Thanks,
Dimitris

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to