summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/information_schema.py
diff options
context:
space:
mode:
authorJonathan Ellis <jbellis@gmail.com>2007-07-29 04:15:14 +0000
committerJonathan Ellis <jbellis@gmail.com>2007-07-29 04:15:14 +0000
commita9a1f912fd9445d7496584a256e449ad1fd2a808 (patch)
tree665b8e937cd5811119f5ce8faa9e844e61190b9e /lib/sqlalchemy/databases/information_schema.py
parentc838a981021b83f5690234b1d55513417306ac61 (diff)
downloadsqlalchemy-a9a1f912fd9445d7496584a256e449ad1fd2a808.tar.gz
engine.table_names()
tested vs sqlite and pg. mssql should also be ok (uses ischema like pg.) others are best-guess based on has_table code.
Diffstat (limited to 'lib/sqlalchemy/databases/information_schema.py')
-rw-r--r--lib/sqlalchemy/databases/information_schema.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/sqlalchemy/databases/information_schema.py b/lib/sqlalchemy/databases/information_schema.py
index 93f47de15..48f33cb96 100644
--- a/lib/sqlalchemy/databases/information_schema.py
+++ b/lib/sqlalchemy/databases/information_schema.py
@@ -98,6 +98,11 @@ class ISchema(object):
return self.cache[name]
+def table_names(connection, schema):
+ s = select([tables.c.table_name], tables.c.table_schema==schema)
+ return [row[0] for row in connection.execute(s)]
+
+
def reflecttable(connection, table, include_columns, ischema_names):
key_constraints = pg_key_constraints