compatibility with sqlalchemy 2.0

Bug #2004022 reported by yatin
22
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Rally
In Progress
Undecided
Mitya Eremeev

Bug Description

rally not compatible with sqlalchemy-2.0.0(requires python3.7+).

Get's below error with sqlalchemy-2.0.0:-
# rally db create [1/1900]
Creating database: sqlite:////tmp/rally.sqlite
Command failed, please check log for more info
2023-01-27 14:17:47.338 2484279 CRITICAL rally [-] Unhandled error: sqlalchemy.exc.InvalidRequestError: This connection has already initialized a
SQLAlchemy Transaction() object via begin() or autobegin; can't call begin() here unless rollback() or commit() is called first.
2023-01-27 14:17:47.338 2484279 ERROR rally Traceback (most recent call last):
2023-01-27 14:17:47.338 2484279 ERROR rally File "/root/tempest/workspace/rally/venv/bin/rally", line 8, in <module>
2023-01-27 14:17:47.338 2484279 ERROR rally sys.exit(main())
2023-01-27 14:17:47.338 2484279 ERROR rally File "/root/tempest/workspace/rally/venv/lib64/python3.9/site-packages/rally/cli/main.py", line 40,
in main
2023-01-27 14:17:47.338 2484279 ERROR rally return cliutils.run(sys.argv, categories)
2023-01-27 14:17:47.338 2484279 ERROR rally File "/root/tempest/workspace/rally/venv/lib64/python3.9/site-packages/rally/cli/cliutils.py", line
669, in run
2023-01-27 14:17:47.338 2484279 ERROR rally ret = fn(*fn_args, **fn_kwargs)
2023-01-27 14:17:47.338 2484279 ERROR rally File "/root/tempest/workspace/rally/venv/lib64/python3.9/site-packages/rally/cli/commands/db.py", li
ne 44, in create
2023-01-27 14:17:47.338 2484279 ERROR rally db.schema.schema_create()
2023-01-27 14:17:47.338 2484279 ERROR rally File "/root/tempest/workspace/rally/venv/lib64/python3.9/site-packages/rally/common/db/schema.py", l
ine 138, in schema_create
2023-01-27 14:17:47.338 2484279 ERROR rally models.BASE.metadata.create_all(engine)
2023-01-27 14:17:47.338 2484279 ERROR rally File "/root/tempest/workspace/rally/venv/lib64/python3.9/site-packages/sqlalchemy/sql/schema.py", li
ne 5558, in create_all
2023-01-27 14:17:47.338 2484279 ERROR rally bind._run_ddl_visitor(
2023-01-27 14:17:47.338 2484279 ERROR rally File "/root/tempest/workspace/rally/venv/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", l
ine 3219, in _run_ddl_visitor
2023-01-27 14:17:47.338 2484279 ERROR rally with self.begin() as conn:
2023-01-27 14:17:47.338 2484279 ERROR rally File "/usr/lib64/python3.9/contextlib.py", line 119, in __enter__
2023-01-27 14:17:47.338 2484279 ERROR rally return next(self.gen)
2023-01-27 14:17:47.338 2484279 ERROR rally File "/root/tempest/workspace/rally/venv/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", l
ine 3210, in begin
2023-01-27 14:17:47.338 2484279 ERROR rally with conn.begin():
2023-01-27 14:17:47.338 2484279 ERROR rally File "/root/tempest/workspace/rally/venv/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", l
ine 853, in begin
2023-01-27 14:17:47.338 2484279 ERROR rally raise exc.InvalidRequestError(
2023-01-27 14:17:47.338 2484279 ERROR rally sqlalchemy.exc.InvalidRequestError: This connection has already initialized a SQLAlchemy Transaction()
 object via begin() or autobegin; can't call begin() here unless rollback() or commit() is called first.
2023-01-27 14:17:47.338 2484279 ERROR rally

Until rally codebase is compatible to sqlalchemy-2.0.0 would be good to pin it.

yatin (yatinkarel)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to rally (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/rally/+/872021

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to rally (master)

Reviewed: https://review.opendev.org/c/openstack/rally/+/872021
Committed: https://opendev.org/openstack/rally/commit/14d449b2f1bc51416053d1e6bdd1a5cd915e527a
Submitter: "Zuul (22348)"
Branch: master

commit 14d449b2f1bc51416053d1e6bdd1a5cd915e527a
Author: yatinkarel <email address hidden>
Date: Fri Jan 27 19:52:08 2023 +0530

    Pin SQLAlchemy to <2.0.0

    Rally code is not compatible with SQLAlchemy-2.0.0,
    until it's compatible let's pin it.

    CI jobs are broken with multiple errors, so to get
    this in also need following fixes:-
    - Remove python-dev from bindep to fix announce-release
      and docs jobs
    - Update upper-constraints for testtools to 2.5.0 to fix
      issues with python3.10+
    - Update tox.ini for tox4 compatibility
    - Ignore warnings introdueced with oslo.db-12.1.0,
      SQLAlchemy-1.4.46
    - Make tox-cover job non-voting as to get it passing
      coverage report need to succeed for previous commit,
      which will not succeed without the required changes
      in this patch. It will be made voting again in follow
      up patch.

    Related-Bug: #2004022
    Change-Id: Ifcffd11e300e1485fdbfa54b23bcdcaa6ad61011

Revision history for this message
Mitya Eremeev (mitos) wrote :

Hi,

the bug is not fixed from "rally-openstack" side.
Scenario:
1. clone repo "openstack-rally"
2. install openstack-rally
pip install .
3. create rally db
rally db create

Actual result:
get error form bug description

Expected result:
Rally db is created successfully

When we install "openstack-rally" pip takes the latest "rally" package (now it's 3.3).
Bugfix is not yet included in new release, so we need some temporary work around...

Changed in rally:
assignee: nobody → Mitya Eremeev (mitos)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to rally-openstack (master)

Reviewed: https://review.opendev.org/c/openstack/rally-openstack/+/873306
Committed: https://opendev.org/openstack/rally-openstack/commit/7ec93aef2ee6e0cec9099d4edf681a39224a18c9
Submitter: "Zuul (22348)"
Branch: master

commit 7ec93aef2ee6e0cec9099d4edf681a39224a18c9
Author: Mitya_Eremeev <email address hidden>
Date: Thu Feb 9 20:18:09 2023 +0300

    Fix creating of Rally DB

    Rally-openstack requires Rally.
    Creation of Rally database was fixed in commit:
    https://github.com/openstack/rally/commit/14d449b2f1bc51416053d1e6bdd1a5cd915e527a
    But the fix is not included yet in new Rally release,
    so we make some workaround untill then.

    Related-Bug: #2004022
    Change-Id: I62adcb49822c24d17167a63f94be5256fd5a697d

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.