views:

138

answers:

1

I want to reflect a schema using SQLAlchemy's MetaData.reflect() method, so that I can have a cache of the current schema. How can I do this?

+1  A: 

A simple and supported way to cache the result of reflection is to just pickle the MetaData object. If you prefer to generate Python code that initializes the metadata, then there's a tool called sqlautocode.

Ants Aasma
I've tried it; wow, does it ever NOT work properly with SQLAlchemy 0.6; I had to patch a bunch of its imports to make it work. It can be done, however.
Chris R