aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/sql/migration_tools.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/db/sql/migration_tools.py')
-rw-r--r--mediagoblin/db/sql/migration_tools.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mediagoblin/db/sql/migration_tools.py b/mediagoblin/db/sql/migration_tools.py
index ee84e06f..e5380a3b 100644
--- a/mediagoblin/db/sql/migration_tools.py
+++ b/mediagoblin/db/sql/migration_tools.py
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin.tools.common import simple_printer
+from sqlalchemy import Table
class MigrationManager(object):
@@ -261,3 +262,9 @@ def assure_migrations_table_setup(db):
if not MigrationData.__table__.exists(db.bind):
MigrationData.metadata.create_all(
db.bind, tables=[MigrationData.__table__])
+
+
+def inspect_table(metadata, table_name):
+ """Simple helper to get a ref to an already existing table"""
+ return Table(table_name, metadata, autoload=True,
+ autoload_with=metadata.bind)