Hi,
I'm learning SQLAlchemy, and a Composite Column seems like a very useful
concept.

However, there are very few mentions of it I can find. So some related
questions after reading some docs and some experimentation.

 * 'Hiding'--let's say that for the Vertex example in the docs, I really
want people to use Vertex.start, and not Vertex.x1/y1. Is it recommended to
name them _x1 and _y1, say by using _x1 = Column('x1, Integer) etc?

 * Validation: let's say I want 'QuadrantOnePoint', i.e. x and y need to be
positive. Is there some way to use @validates in the composite class (e.g.
Point)? Even better in the constructor somehow, so that Point can also be
used elsewhere, but with the caveat that it's probably bad for the system
to fail to load if data in the DB is somehow invalid.

 I see the MutableBase.coerce() note about validation, but I want the
validation used primarily at the constructor (e.g. v1 =
Vertex(start=Point(3, 4), end=Point(12, 15)) should work, but v1 =
Vertex(start=Point(-3, 4), end=Point(12, -15)) should fail, because the two
Point constructors are both for points outside the valid range.

 * Queries: if someone does query(Vertex).filter(start == Point(0,0)), that
seems to work (at least using a my own similar class). But not filter(start
>= Point(1,1)). I get "NotImplementedError: <built-in function gt>".
Implementing __gt__ on Point does not fix this. Is something else (say
a comparator_factory) required?


Thanks,
Matthew

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to