views:

53

answers:

1

Our project is basically a web interface to several systems of record. We have many tables mapped, and the names of each column aren't as well named and intuitive as we'd like... The users would like to know what data fields are available (i.e. what's been mapped from the database). But, it's pointless to just give them column names like: USER_REF1, USER_REF2, etc.

So, I was wondering, is there a way to provide a comment in the declaration of my field?

E.g.

class SegregationCode(Entity):
    using_options(tablename="SEGREGATION_CODES")
    segCode = Field(String(20), colname="CODE", ...
                    primary_key=True) #Have a comment attr too?

If not, any suggestions?

A: 

Doing some research thru the SQLAlchemy documentation, my buddy and I found a line that says the Column object has a default dictionary called info that is a space to store "application specific data." So, in my case, I can just doing something like:

class SegregationCode(Entity):
    using_options(tablename="SEGREGATION_CODES")
    segCode = Field(String(20), colname="CODE", ...
                    primary_key=True, info={'description'='Segregation Code'})
kchau