Hi guys,
with latest taskflow(5.4.0), SQLAlchemy(2.0.21) and alembic(1.12.0), I tried to dbsync by using SQLAlchemyBackend.get_connection().upgrade() method. However, it raised AttributeError: 'Connection' object has no attribute 'connect' when I executed conn.upgrade() statement. It seems a problem. Codes and error are as follows.
====================
reproduce process
====================
python
>>> from taskflow.persistence.backends.impl_sqlalchemy import SQLAlchemyBackend
>>> conf={'connection': 'mysql+pymysql://test:123456@127.0.0.1:3306/test'}
>>> conn=SQLAlchemyBackend(conf).get_connection()
>>> conn.upgrade()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/site-packages/taskflow/persistence/backends/impl_sqlalchemy.py", line 405, in upgrade
migration.db_sync(conn)
File "/usr/local/lib/python3.9/site-packages/taskflow/persistence/backends/sqlalchemy/migration.py", line 33, in db_sync
command.upgrade(cfg, revision)
File "/usr/local/lib/python3.9/site-packages/alembic/command.py", line 399, in upgrade
script.run_env()
File "/usr/local/lib/python3.9/site-packages/alembic/script/base.py", line 578, in run_env
util.load_python_file(self.dir, "env.py")
File "/usr/local/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
module = load_module_py(module_id, path)
File "/usr/local/lib/python3.9/site-packages/alembic/util/pyfiles.py", line 109, in load_module_py
spec.loader.exec_module(module) # type: ignore
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/usr/local/lib/python3.9/site-packages/taskflow/persistence/backends/sqlalchemy/alembic/env.py", line 78, in <module>
run_migrations_online()
File "/usr/local/lib/python3.9/site-packages/taskflow/persistence/backends/sqlalchemy/alembic/env.py", line 68, in run_migrations_online
with connectable.connect() as connection:
AttributeError: 'Connection' object has no attribute 'connect'