Mike wrote: > > I started looking to what is happen to get table information from > mysql. > > I found that the following is issued for every table that is > reflected: > > 2007-07-18 00:29:08,158 INFO sqlalchemy.engine.base.Engine.0x..cc > show variables like 'character_set%%' > 2007-07-18 00:29:08,158 INFO sqlalchemy.engine.base.Engine.0x..cc > None 2007-07-18 00:29:08,161 INFO > sqlalchemy.engine.base.Engine.0x..cc SHOW VARIABLES LIKE > 'lower_case_table_names' > 2007-07-18 00:29:08,161 INFO sqlalchemy.engine.base.Engine.0x..cc > None 2007-07-18 00:29:08,163 INFO > sqlalchemy.engine.base.Engine.0x..cc describe `company` > 2007-07-18 00:29:08,163 INFO sqlalchemy.engine.base.Engine.0x..cc > {} 2007-07-18 00:29:08,169 INFO > sqlalchemy.engine.base.Engine.0x..cc SHOW CREATE TABLE `company` > > > I have a slow connection to the database and want to min the > number of round trips. > [...]
Hi Mike, You're right, the lower_case check is really needed only once per connection and I've added that per-connection cache in r2955 for 0.4. That's as granular as that can get, as the value can change on a server restart and that can't be detected directly. The character set can change mid-connection and there's unfortunately no easy way around performing that check, at least for 4.1 and higher servers. It would be easier if the driver was the only mechanism to change the connection character set, but a variety of user SQL can as well. Moving all of the MySQL reflection to a SHOW CREATE TABLE parser is in progress for 0.4. If you have a patch in mind for column parsing I'd be happy to take a look and include it. As an aside, starting with 0.3.9 the table metadata is picklable. Just unpickle it and bind it to an engine, and you can avoid reflection on your slow link entirely. -j --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---