diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-06 11:49:45 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-06 11:49:45 -0400 |
commit | 4e2c0f10cd164511b9c6377b72a8c0527e4eb716 (patch) | |
tree | 830319060dc68ec7de0eaa04eaf8ba8e7948d535 /lib/sqlalchemy/schema.py | |
parent | d9dc05adb689bc4eab2227a96af0d874696cc63d (diff) | |
parent | 30bc42403754110df1fdec3037c7700cc4f26b70 (diff) | |
download | sqlalchemy-4e2c0f10cd164511b9c6377b72a8c0527e4eb716.tar.gz |
- merge tip
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r-- | lib/sqlalchemy/schema.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 8070fd9ca..6966fb90b 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -1988,7 +1988,7 @@ class MetaData(SchemaItem): from sqlalchemy.sql.util import sort_tables return sort_tables(self.tables.itervalues()) - def reflect(self, bind=None, schema=None, only=None): + def reflect(self, bind=None, schema=None, views=False, only=None): """Load all available table definitions from the database. Automatically creates ``Table`` entries in this ``MetaData`` for any @@ -2004,7 +2004,10 @@ class MetaData(SchemaItem): :param schema: Optional, query and reflect tables from an alterate schema. - + + :param views: + If True, also reflect views. + :param only: Optional. Load only a sub-set of available named tables. May be specified as a sequence of names or a callable. @@ -2033,6 +2036,11 @@ class MetaData(SchemaItem): available = util.OrderedSet(bind.engine.table_names(schema, connection=conn)) + if views: + available.update( + bind.dialect.get_view_names(conn or bind, schema) + ) + current = set(self.tables.iterkeys()) if only is None: |