← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1962153] [NEW] Transition to SQLAlchemy 2.0

 

Public bug reported:

The ``Session.autocommit`` parameter is deprecated and will be removed
in SQLAlchemy version 2.0.  The Session now features ``autobegin``
behavior such that the Session.begin() method may be called if a
transaction has not yet been started yet. See the section
session_explicit_begin for background.

In Neutron/neutron-lib, the property ``Session.is_active`` [1] is used
to determine if a session has an active transaction. With
"autocommit=False", the transaction is never closed once created. That
means the property will return "True" even when the transaction has
flushed all pending commands.

In order to mimic the previous behaviour, we need to find an alternative
method to decide if the session has any pending command to be flushed.

Related topic: https://review.opendev.org/q/topic:sqlalchemy-20

[1]https://github.com/sqlalchemy/sqlalchemy/blob/878c37614efd311794aa50467dbb9e3fe972fdff/lib/sqlalchemy/orm/session.py#L3809-L3837

** Affects: neutron
     Importance: Undecided
     Assignee: Rodolfo Alonso (rodolfo-alonso-hernandez)
         Status: In Progress

** Description changed:

  The ``Session.autocommit`` parameter is deprecated and will be removed
  in SQLAlchemy version 2.0.  The Session now features ``autobegin``
  behavior such that the Session.begin() method may be called if a
  transaction has not yet been started yet. See the section
  session_explicit_begin for background.
  
  In Neutron/neutron-lib, the property ``Session.is_active`` [1] is used
  to determine if a session has an active transaction. With
  "autocommit=False", the transaction is never closed once created. That
  means the property will return "True" even when the transaction has
  flushed all pending commands.
  
  In order to mimic the previous behaviour, we need to find an alternative
  method to decide if the session has any pending command to be flushed.
  
+ Related topic: https://review.opendev.org/q/topic:sqlalchemy-20
  
  [1]https://github.com/sqlalchemy/sqlalchemy/blob/878c37614efd311794aa50467dbb9e3fe972fdff/lib/sqlalchemy/orm/session.py#L3809-L3837

** Changed in: neutron
     Assignee: (unassigned) => Rodolfo Alonso (rodolfo-alonso-hernandez)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1962153

Title:
  Transition to SQLAlchemy 2.0

Status in neutron:
  In Progress

Bug description:
  The ``Session.autocommit`` parameter is deprecated and will be removed
  in SQLAlchemy version 2.0.  The Session now features ``autobegin``
  behavior such that the Session.begin() method may be called if a
  transaction has not yet been started yet. See the section
  session_explicit_begin for background.

  In Neutron/neutron-lib, the property ``Session.is_active`` [1] is used
  to determine if a session has an active transaction. With
  "autocommit=False", the transaction is never closed once created. That
  means the property will return "True" even when the transaction has
  flushed all pending commands.

  In order to mimic the previous behaviour, we need to find an
  alternative method to decide if the session has any pending command to
  be flushed.

  Related topic: https://review.opendev.org/q/topic:sqlalchemy-20

  [1]https://github.com/sqlalchemy/sqlalchemy/blob/878c37614efd311794aa50467dbb9e3fe972fdff/lib/sqlalchemy/orm/session.py#L3809-L3837

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1962153/+subscriptions



Follow ups