summaryrefslogtreecommitdiff
path: root/alembic/batch.py
diff options
context:
space:
mode:
Diffstat (limited to 'alembic/batch.py')
-rw-r--r--alembic/batch.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/alembic/batch.py b/alembic/batch.py
index 6e5dc75..1006739 100644
--- a/alembic/batch.py
+++ b/alembic/batch.py
@@ -58,12 +58,15 @@ class BatchOperationsImpl(object):
else:
m1 = MetaData()
- existing_table = Table(
- self.table_name, m1,
- schema=self.schema,
- autoload=True,
- autoload_with=self.operations.get_bind(),
- *self.reflect_args, **self.reflect_kwargs)
+ if self.copy_from is not None:
+ existing_table = self.copy_from
+ else:
+ existing_table = Table(
+ self.table_name, m1,
+ schema=self.schema,
+ autoload=True,
+ autoload_with=self.operations.get_bind(),
+ *self.reflect_args, **self.reflect_kwargs)
batch_impl = ApplyBatchImpl(
existing_table, self.table_args, self.table_kwargs)