##// END OF EJS Templates
engine: use new visitor-callable from latest version
super-admin -
r5164:19fefcb8 default
parent child Browse files
Show More
@@ -138,7 +138,7 b' def alter_column(*p, **k):'
138 138 delta = ColumnDelta(*p, **k)
139 139
140 140 visitorcallable = get_engine_visitor(engine, 'schemachanger')
141 engine._run_visitor(visitorcallable, delta)
141 _run_visitor(engine, visitorcallable, delta)
142 142
143 143 return delta
144 144
@@ -167,6 +167,20 b' def _to_index(index, table=None, engine='
167 167 return ret
168 168
169 169
170 def _run_visitor(
171 connectable, visitorcallable, element, connection=None, **kwargs
172 ):
173 if connection is not None:
174 visitorcallable(
175 connection.dialect, connection, **kwargs).traverse_single(element)
176 else:
177 conn = connectable.connect()
178 try:
179 visitorcallable(
180 conn.dialect, conn, **kwargs).traverse_single(element)
181 finally:
182 conn.close()
183
170 184
171 185 # Python3: if we just use:
172 186 #
@@ -568,7 +582,7 b' populated with defaults'
568 582 self.add_to_table(table)
569 583 engine = self.table.bind
570 584 visitorcallable = get_engine_visitor(engine, 'columngenerator')
571 engine._run_visitor(visitorcallable, self, connection, **kwargs)
585 _run_visitor(engine, visitorcallable, self, connection, **kwargs)
572 586
573 587 # TODO: reuse existing connection
574 588 if self.populate_default and self.default is not None:
@@ -589,7 +603,7 b' populated with defaults'
589 603 self.table = table
590 604 engine = self.table.bind
591 605 visitorcallable = get_engine_visitor(engine, 'columndropper')
592 engine._run_visitor(visitorcallable, self, connection, **kwargs)
606 _run_visitor(engine, visitorcallable, self, connection, **kwargs)
593 607 self.remove_from_table(self.table, unset_table=False)
594 608 self.table = None
595 609 return self
General Comments 0
You need to be logged in to leave comments. Login now