Am Mittwoch, 19. September 2007 23:44 schrieb Paul Johnston:
> Hi,
>
> >For my documentation, it is very handy to gather the table definitions
> >directly from my SQLAlchemy-based python code - that's relatively easy, I
>
> This would be useful for me too, and it would be good to have hooks to
> store arbitrary information. I'd be using this as hints for a form
> builder, just like the Django auto-admin does.
I currently do it like this:
class DocTable(Table):
""" Extends Table by adding a description attribute """
def __init__(self, name, metadata, **kwargs):
""" Extract some parameters and call parent """
description = kwargs.pop('description', None)
self.description = description
super(DocTable, self).__init__(name, metadata, **kwargs)
class DocColumn(Column):
""" Extends Column by adding a description attribute """
def __init__(self, name, type_, *args, **kwargs):
""" Extract some parameters and call parent """
description = kwargs.pop('description', None)
self.description = description
super(DocColumn, self).__init__(name, type_, *args, **kwargs)
And then I use "DocTable" / "DocColumn" instead of Table/Column.
Regards,
Hermann
--
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---