From 7af933d1d06006b40c48bbac8708b5a54899908c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <henrik@trineo.org> Date: Mon, 2 May 2022 21:38:55 +0200 Subject: [PATCH] DOC: document further ideas on how to design the Python client in future --- src/doc/future_caosdb.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/doc/future_caosdb.md b/src/doc/future_caosdb.md index 1a68e434..de6170fa 100644 --- a/src/doc/future_caosdb.md +++ b/src/doc/future_caosdb.md @@ -69,6 +69,11 @@ Analogue, to what Pandas does. Provide bracket notation `rec.properties["test"]` for Properties with names that are in conflict with default attributes or contain spaces (or other forbidden characters). +Entities can be initialized with a set of Propertynames. Those Propertynames will be used as +attributes such that tab completion is possible in interactive use. The value however will be a special +value (e.g. UnsetPropertyValue) and accessing it results in an Exception. Thus, tab completion can be used +but no Properties are inserted unexpectedly with NULL values. + - Raise Exception if attribute does not exist but is accessed? [Discussion](https://gitlab.com/caosdb/caosdb-pylib/-/issues/60) @@ -168,6 +173,14 @@ inserted = new_one.insert() print("The new record has the ID:", inserted.id) ``` +### Factory method +While creating an Entity will not talk to a CaosDB server and can thus be done offline, the factory method +`create_record` allows to +1. Retrieve the parent and set attributes according to inheritance +2. Use a container to resolve the parent and set attributes + +In general, more complex "magic" will be placed in the factory and only the straight forward version +in the constructor. ### References and sub entities -- GitLab