On Mon, Nov 16, 2009 at 06:57, BruceC <bruce.co...@hp.com> wrote: > I'm trying to implement a character counter on all textarea fields in > my Elixir-SQLA-Pylons app, & need to find a way to determine the > maximum number of characters a given column can hold, so I can supply > the character counter with a "Maximum characters" value. Anyone know > of a simple method of finding the size-limit of a column?
I use some code which is along the lines of: prop_length = {} for prop in mapper.iterate_properties: if isinstance(prop, sqlalchemy.orm.properties.ColumnProperty): col = prop.columns[0] if isinstance(col, sqlalchemy.schema.Column): if col.type.__class__ in (sqlalchemy.Unicode, sqlalchemy.String): if col.type.length: prop_length[prop.key] = col.type.length -- Gaƫtan de Menten http://openhex.org --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---