I find column comments often useful, and though they may not be SQL
standard, they are supported by all major databases.
-- Christoph
I started using info dict on a column names in sa file definitions. It
would be nice to save it to db if once could. What db supports
comments and what table name is it?
Lucas
Oracle and PostgreSQL have the "comment on" SQL statement. MySQL has a
comment clause for column definitions. SA could abstract away these
differences, the syntax would be something like this:
users = Table('users', metadata,
Column('id', Integer, primary_key=True),
Column('name', String(40), comment="The Unix user name"),
Column('fullname', String(100), comment="Full name with title"))
This way, the table definition in Python itself would be commented, and
at the same time, comments on the database would be created that help
you if you operate directly on the database with some admin tool.
-- Christoph
I think I prefer "info" dictionary rather then a string. Dict "info"
which I use already have something like this:
sqlalchemy.Column('DRIVE_TRAIN', sqlalchemy.Unicode(4)
,info={"description":"DRIVE TRAIN TYPE [AWD,4WD,FWD,RWD]"}),
sqlalchemy.Column('FUEL_SYS', sqlalchemy.Unicode(4)
,info={"description":"FUEL SYSTEM CODE",
"FI":"FUEL INJECTION",
"TB":"TURBO"}),
Would be nice if the whole dictionary was written to a database. I
could use info[description], info[FI], info[TB] etc... when I display
data. That would be really useful definition!!!
Lucas
I think you're mixing different things here. What I suggested was
support of the database comment statement/clause supported by all major
databases (except maybe SQL Server).
What you're looking for seems to be something similar to the "Domain"
feature of the old Oracle Designer,
http://marceloverdijk.blogspot.com/2008/05/ref-code-plugin.html
http://its.unm.edu/ais/docs/oradomains.htm
This would be an interesting extension as well. Should be possible with
a custom TypeDecorator or TypeEngine.
-- Christoph
I see.
>
> What you're looking for seems to be something similar to the "Domain"
> feature of the old Oracle Designer,
I wonder if it was possible to save the info field "{}" I showed above
via the comment statement/clause you are mentioning if it gets
implemented?
This would really help in describing business rules and descriptions
of each column.
Lucas
>
> http://marceloverdijk.blogspot.com/2008/05/ref-code-plugin.html
> http://its.unm.edu/ais/docs/oradomains.htm
>
> This would be an interesting extension as well. Should be possible with
> a custom TypeDecorator or TypeEngine.
>
> -- Christoph
>
> >
>
--
Automotive Recall Database. Cars, Trucks, etc.
http://www.lucasmanual.com/recall/
TurboGears Manual-Howto
http://lucasmanual.com/pdf/TurboGears-Manual-Howto.pdf