Skip to content

Commit

Permalink
remove unnecesary future=True param in engines
Browse files Browse the repository at this point in the history
  • Loading branch information
eloyfelix committed Jan 27, 2023
1 parent 1305063 commit d4c3ea8
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions cbl_migrator/migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def fill_table(o_eng_conn, d_eng_conn, table, chunk_size):
Fills existing table in dest with origin table data.
"""
logger.info(f"Migrating {table.name} table")
d_eng = create_engine(d_eng_conn, future=True)
o_eng = create_engine(o_eng_conn, future=True)
d_eng = create_engine(d_eng_conn)
o_eng = create_engine(o_eng_conn)

if d_eng.name == "mysql":
# https://github.com/sqlalchemy/sqlalchemy/blob/ed78e679eafe787f4c152b78726bf1e1b91ab465/lib/sqlalchemy/dialects/mysql/base.py#L2332
Expand Down Expand Up @@ -140,7 +140,7 @@ def __init__(self, o_conn_string, d_conn_string, exclude=[], n_workers=4):
self.d_eng_conn = d_conn_string
self.n_cores = n_workers

o_eng = create_engine(self.o_eng_conn, future=True)
o_eng = create_engine(self.o_eng_conn)
metadata = MetaData()
metadata.reflect(o_eng)
no_pk = []
Expand Down Expand Up @@ -181,8 +181,8 @@ def __copy_schema(self):
Copies the schema to dest db.
Copies all constraints in sqlite, only pk in mysql and postgres.
"""
o_eng = create_engine(self.o_eng_conn, future=True)
d_eng = create_engine(self.d_eng_conn, future=True)
o_eng = create_engine(self.o_eng_conn)
d_eng = create_engine(self.d_eng_conn)
metadata = MetaData()
metadata.reflect(o_eng)
insp = inspect(o_eng)
Expand Down Expand Up @@ -234,10 +234,10 @@ def validate_migration(self):
"""
Checks that counts for all tables in origin an dest dbs are equal.
"""
o_eng = create_engine(self.o_eng_conn, future=True)
o_eng = create_engine(self.o_eng_conn)
o_metadata = MetaData()
o_metadata.reflect(o_eng)
d_eng = create_engine(self.d_eng_conn, future=True)
d_eng = create_engine(self.d_eng_conn)
d_metadata = MetaData()
d_metadata.reflect(d_eng)

Expand Down Expand Up @@ -271,8 +271,8 @@ def __copy_constraints(self):
"""
Migrates constraints, UKs, CCs and FKs.
"""
o_eng = create_engine(self.o_eng_conn, future=True)
d_eng = create_engine(self.d_eng_conn, future=True)
o_eng = create_engine(self.o_eng_conn)
d_eng = create_engine(self.d_eng_conn)
metadata = MetaData()
metadata.reflect(o_eng)

Expand Down Expand Up @@ -315,8 +315,8 @@ def __copy_indexes(self):
"""
Creates indexes in dest when possible.
"""
o_eng = create_engine(self.o_eng_conn, future=True)
d_eng = create_engine(self.d_eng_conn, future=True)
o_eng = create_engine(self.o_eng_conn)
d_eng = create_engine(self.d_eng_conn)
metadata = MetaData()
metadata.reflect(o_eng)

Expand Down Expand Up @@ -359,8 +359,8 @@ def migrate(
copy_indexes: Bool. False won't create indexes in dest.
chunk_size: Number of records copied in each chunk.
"""
o_eng = create_engine(self.o_eng_conn, future=True)
d_eng = create_engine(self.d_eng_conn, future=True)
o_eng = create_engine(self.o_eng_conn)
d_eng = create_engine(self.d_eng_conn)

if o_eng.dialect.max_identifier_length > d_eng.dialect.max_identifier_length:
logger.info(f"{o_eng.name} max_identifier_length larger than {d_eng.name}")
Expand Down

0 comments on commit d4c3ea8

Please sign in to comment.