AF wrote:
>
> Hello,
>
> Can validators be defined at table / mapper level?   (Is it even a
> good idea?)
>
> I ask, since it's at the table definition layer that I define what
> datatypes my columns have, so it seems natural to place the policing
> function there as well.


a "table level" validator would be a database-side CHECK CONSTRAINT or
trigger.

If you have mapper definitions separate from classes, theres nothing
stopping you from adding attributes to the class over there, i.e.

mapper(MyClass, mytable)

MyClass.foo = some_validation_decorator(MyClass.foo)

Personally I wouldn't bother (then again I use declarative for everything
now).



>
> :)
> >
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to