From 7f0153d5bd663abbba942aa3816fc0ee0353010f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Thu, 8 Feb 2024 16:53:44 +0100 Subject: [PATCH] MAINT: quote name and cache query --- src/caoscrawler/identifiable_adapters.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/caoscrawler/identifiable_adapters.py b/src/caoscrawler/identifiable_adapters.py index 64b9d380..dd520a5a 100644 --- a/src/caoscrawler/identifiable_adapters.py +++ b/src/caoscrawler/identifiable_adapters.py @@ -27,8 +27,8 @@ from __future__ import annotations import logging from abc import ABCMeta, abstractmethod -from functools import lru_cache from datetime import datetime +from functools import lru_cache from typing import Any import caosdb as db @@ -44,7 +44,7 @@ logger = logging.getLogger(__name__) def get_children_of_rt(rtname): """Supply the name of a recordtype. This name and the name of all children RTs are returned in a list""" - return [p.name for p in cached_query(f"FIND RECORDTYPE {rtname}")] + return [p.name for p in cached_query(f"FIND RECORDTYPE '{rtname}'")] def convert_value(value: Any): @@ -477,8 +477,7 @@ class CaosDBIdentifiableAdapter(IdentifiableAdapter): return cached_get_entity_by(path=identifiable) if identifiable.path is None: raise RuntimeError("Path must not be None for File retrieval.") - candidates = db.execute_query("FIND File which is stored at '{}'".format( - identifiable.path)) + candidates = cached_get_entity_by(path=identifiable.path) if len(candidates) > 1: raise RuntimeError("Identifiable was not defined unambigiously.") if len(candidates) == 0: -- GitLab