when you reflect a table from the DB, and you get back PGString, that is the actual type instance. In some cases, table reflection could be mapped to a type instance that is specific to that DB (such as MySQL's enum). i dont think changing the __repr__ of all the db- specific types to return a "fake" constructor is such a great idea. you can use the database-specific constructors, such as PGString or whatever, when constructing a Table. its just usually not so convenient.
On Nov 8, 2006, at 5:35 PM, jeffk wrote: > > Michael Bayer wrote: >> __repr__() really annoys me because no matter what i do with it, >> people >> tell me im using it incorrectly. technically, __repr__() is supposed >> to return a string that when eval'ed would return the object >> instance. >> which is not realistic for an object like Table since its an enormous >> construction. >> >> if you want to take Tables and produce some kind of string >> representation, I recommend you create yourself a >> SchemaVisitor...since >> __repr__() is not something id write code against in this case. > > Thanks. In my limited case the __repr__ is close enough to treat it as > a string for post-processing. All I need is to replace the field type > instance with the proper constructor. These are one-off operations in > order to commit a matching sqlalchemy model for existing versioned DDL > to the repository. > > Would it be useful to add __repr__() roundtripping as long-term trac > ticket? > > Acknowledging that full general-case __repr__ may be impractical, if > anyone saw the ticket and had ideas for incremental improvements, > __repr__ would seem to be amenable to test cases, documented > limitations, etc. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---