-
-
Notifications
You must be signed in to change notification settings - Fork 578
Open
Description
Problem
Currently, the AnalyzerReport.create_data_model method creates a new BaseDataModel instance every time it is called, even if an identical data model already exists in the database. This leads to redundant data storage and unnecessary object creation.
There is an existing TODO in api_app/analyzers_manager/models.py highlighting this:
# TODO we don't need to actually crate a new object every time.
# if the report is the same of the previous one, we can just link itProposed Solution
Modify create_data_model to:
- Construct the data model dictionary as usual.
- Query the database for an existing data model of the correct class that matches the fields in the dictionary.
- If a match is found, reuse the existing object.
- If no match is found, proceed to create a new one.
I would like to work on it. Please let me know if there are any changes needed for this approach.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels