Skip to content
Snippets Groups Projects

ENH: add entity getters and cached functions

Merged Henrik tom Wörden requested to merge f-entity-getters into dev
All threads resolved!
Files
4
@@ -224,14 +224,14 @@ list-valued attribute in Python, as the following example illustrates.
.. note::
Properties of Entities, that shall be updated, need to have IDs. Let's look at an
Properties of Entities that shall be updated need to have IDs. Let's look at an
example:
.. code:: python
experiment = db.Record(id=1111).retrieve()
experiment.add_property(name='date', value="2020-01-01")
retrieved.update() # Fails! The date Property needs to have an ID.
retrieved.update() # Fails! The 'date' Property needs to have an ID.
The easiest way to get around this is to use the corresponding entity getter:
@@ -239,10 +239,10 @@ The easiest way to get around this is to use the corresponding entity getter:
experiment = db.Record(id=1111).retrieve()
experiment.add_property(db.get_entity_by_name('date'), value="2020-01-01")
retrieved.update() # Works!
retrieved.update() # Works!
There are also the functions ``get_entity_by_path`` and ``get_entity_by_id``. You can easily use
cached versions of those functions (see :doc:`Entity Getters<Entity-Getters>`).
There also are the functions ``get_entity_by_path`` and ``get_entity_by_id``. You can easily use
cached versions of those functions (see :doc:`caching options<caching>`).
File Update
Loading