UniqueNamesError when updating files
Created by: Quazgar
Somehow files in our CaosDB where inserted with names (e.g. name="analysis.py"). In contrast to the usual situation many files have the same name. If one now tries to update one of these (e.g. to add a parent="Source"), the following error is thrown:
Traceback (most recent call last):
File "./crawl.py", line 65, in <module>
c.crawl(files)
File "/home/professional/.local/lib/python3.7/site-packages/caosadvancedtools/crawler.py", line 49, in crawl
cfood.treat_match(crawled_file, match)
File "/home/professional/.local/lib/python3.7/site-packages/caosadvancedtools/cfood.py", line 113, in treat_match
self.update_identifiables(entities, crawled_file, match)
File "/home/professional/CaosDB/caosdb-bmp/converter_scripts/specification_crawler/rheo_ana_cfood.py", line 132, in update_identifiables
fi.update()
File "/home/professional/.local/lib/python3.7/site-packages/caosdb/common/models.py", line 879, in update
flags=flags)[0]
File "/home/professional/.local/lib/python3.7/site-packages/caosdb/common/models.py", line 2520, in update
raise_errors(cresp)
File "/home/professional/.local/lib/python3.7/site-packages/caosdb/common/models.py", line 3301, in raise_errors
raise t
File "/home/professional/.local/lib/python3.7/site-packages/caosdb/common/models.py", line 3275, in raise_errors
raise_errors(e)
File "/home/professional/.local/lib/python3.7/site-packages/caosdb/common/models.py", line 3257, in raise_errors
raise r
File "/home/professional/.local/lib/python3.7/site-packages/caosdb/common/models.py", line 3239, in raise_errors
raise UniqueNamesError(error=e, entity=arg0)
caosdb.exceptions.UniqueNamesError: FILE (362608,'cluster_ad_hoc_model.py') CAUSED UniqueNamesError: Name is already in use. Choose a different name or reuse an existing entity.
Imported comments:
By Timm Fitschen on 2020-10-28T13:36:41.614Z
problem is in InsertFilesInDir.java
final String targetPath = root + sub.getName();
final Entity newFileEntity = new Entity(sub.getName(), Role.File);
final long size = sub.length();
By Alexander Schlemmer on 2020-10-28T13:36:27.649Z
A procedure in the server automatically assigns names to files. This should be changed.
By Timm Fitschen on 2019-09-03T06:28:19.746Z
changed due date to October 02, 2019
By Timm Fitschen on 2019-08-29T13:28:12.716Z
changed due date to September 04, 2019
By Timm Fitschen on 2019-08-29T13:27:58.292Z
assigned to @timm.fitschen and unassigned @henrik_indiscale
By Quazgar on 2019-08-13T09:44:29.167Z
assigned to @henrik_indiscale and unassigned @quazgar