Skip to content

Commit 6ec05a9

Browse files
committed
fixed Object of type <License> not in session, add operation along 'Rule.licenses' won't proceed session.commit()
1 parent 6758d1b commit 6ec05a9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

functions-python/tasks_executor/src/tasks/licenses/populate_licenses.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ def populate_licenses_task(dry_run, db_session):
8989
if not license_object:
9090
license_object = License(id=license_id)
9191
license_object.created_at = datetime.now(timezone.utc)
92+
# Add the new license object to the session immediately.
93+
# This makes it "pending" and allows SQLAlchemy to track relationship changes.
94+
db_session.add(license_object)
9295

9396
license_object.is_spdx = is_spdx
9497
if is_spdx:

0 commit comments

Comments
 (0)