gabotorresruiz commented on code in PR #44928:
URL: https://github.com/apache/superset/pull/44928#discussion_r4222423017


##########
superset/versioning/unit_of_work.py:
##########
@@ -16,12 +16,39 @@
 # under the License.
 """Runtime capture suppression at Continuum's transaction-scoped write 
boundary."""
 
+from itertools import chain
+
+from sqlalchemy.engine import Connection
 from sqlalchemy.orm import Session
+from sqlalchemy_continuum import versioning_manager
 from sqlalchemy_continuum.operation import Operations
 from sqlalchemy_continuum.unit_of_work import UnitOfWork
+from sqlalchemy_continuum.utils import is_versioned
 
 from superset.versioning.utils import capture_enabled
 
+INITIAL_STATES_KEY: str = "_version_changes_initial_states"
+
+
+def _has_versioned_work(session: Session) -> bool:
+    """Recognize pending parents, children, deletes, or retained pre-flush 
state."""
+    return bool(session.info.get(INITIAL_STATES_KEY)) or any(
+        is_versioned(obj) for obj in chain(session.new, session.dirty, 
session.deleted)

Review Comment:
   That works for me. Agreed the win here is the installed predicate case, and 
a `predicate is None` fast path is its own change with its own numbers, since 
it trades a config lookup for a scan that grows with the pending set. Nothing 
further from me on this thread.
   
   I also checked `d2d69c3632`: both `reason` strings lost the id and 
`strict=True` plus `raises=sa.exc.OperationalError` are untouched, so the 
xfails still fail the suite if they ever start passing.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to