On Aug 26, 2010, at 5:09 AM, Alessandro Dentella wrote:
> On Tue, Aug 24, 2010 at 02:48:37PM -0400, Michael Bayer wrote:
>>> Info option is clearly very handy. At the moment I implemented an image
>>> field in sqlkit, (that's just a bunch of handler in the gui). In order to do
>>> that I used a type inherited with no addition, just to understand that that
>>> field is the path to an Image:
>>>
>>> class Image(String): pass
>>>
>>> clearly another alternative would be to use info={ 'image': true} or
>>> similar. Is there some caveat that would make one preferred over the other?
>>
>> The caveat there is that table reflection, which isn't used in your case,
>> would produce VARCHAR and not String, or your custom Image type. It also
>> creates a hard linkage of SQLAlchemy type objects to the behavior of your
>> application. The "info" approach allows the type and your application's
>> interpretation of a field to vary independently.
>
> ok, I switched to using .info and I honestly appreciate it.
>
> am I wrong or Columns created with orm.column_property() don't have .info
> attribute? Any chance to add it?
dig in to class.attr.property.columns[0] or class.attr.__clause_element__().
Its probably a good idea for .info to be shared on the class.attr at some
point.
>
> sandro
> *:-)
>
>
> --
> Sandro Dentella *:-)
> http://sqlkit.argolinux.org SQLkit home page - PyGTK/python/sqlalchemy
>
> --
> 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.
>
--
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.