Hi Iain, > I'm working on an admin interface and trying to make it generic when > that will do, a la django, but more easily customizable. A couple of > things I could not yet find in the SA docs, can anyone point me to the > right place or if they know pipe up? > > - how would one ask a mapper object for its underlying table(s)? >
This is what I use. mapper.local_table.c It seems to give me the columns in the same order as I define them in my Table object. > - I found out that table_name._orig_cols gives me the column names and > types, but as it's in a dict, it's not ordered > > - the repr of a table name gives the Table object, which has the columns > listed in order. Before I do something stupid like slice up this repr > with reg exes, is there an easy way to access the columns and their > attributes in the order they are declared in the Table call? > > Lastly, is anyone working on this kind of stuff with pointers or code > that I should look at? I'm sure I'm going to do some silly stuff on my > own. ;) > > For generic admin interfaces, I would use the autoload=True feature. However, this may not give you the ordering of columns which you desire because it's totally up to the database server how the order of the columns are returned when SA queries the metadata. I got around this by mimicking what django does, that is define a inner Admin class on my model classes with similar types of properties as you would find in django to control the layout of tables,forms,lists etc. You don't have to use the inner class but it boils down to have some sort of metadata (whether it's in code,config files,xml etc) to help you auto generate gui stuff. The rich metadata which SA captures is awesome for this type of stuff. Hope that helps. Huy > Thanks > Iain > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---