Closed keshav-space closed 4 months ago
- It doesn't look like
merge_or_create_resource
merges data, but just overwrites the existing values on the Resource with new values. (https://github.com/nexB/purldb/blob/main/minecode/model_utils.py#L428) In the case where we have an existing Resource with symbol data stored in theextra_data
field, the contents of theextra_data
field will be overwritten if the incoming Resource data has values in there. I think it would make sense to append the newextra_data
to the existing one instead of overwriting it, but I wanted to know what you think.
@JonoYang We could append data, but wouldn't that be more confusing? Suppose we already have source_symbols
in the resource. If we reindex this package with a new version of source_inspector
I don't think it would make sense to append this to the existing source_symbols
.
@JonoYang We could append data, but wouldn't that be more confusing? Suppose we already have
source_symbols
in the resource. If we reindex this package with a new version ofsource_inspector
I don't think it would make sense to append this to the existingsource_symbols
.
That's a good point. I think it would be good to rename merge_or_create_resource
to update_or_create_resource
and remove the merged
variable in the function.
@JonoYang I've renamed the merge_or_create_resource
and also added the test.