caosdb.common.datatype module

caosdb.common.datatype.LIST(datatype)
caosdb.common.datatype.get_id_of_datatype(datatype)

returns the id of a Record Type

This is not trivial, as queries may also return children. A check comparing names is necessary.

Parameters

datatype (string) – A datatype, e.g. DOUBLE, or LIST<Person>

Returns

Return type

The id of the RecordType with the same name as the datatype.

Raises
caosdb.common.datatype.get_list_datatype(datatype)

returns the datatype of the elements in the list

caosdb.common.datatype.get_referenced_recordtype(datatype)

Return the record type of the referenced datatype.

Raises

ValueError – In cases where datatype is not a reference, the list does not have a referenced record type or the datatype is a FILE.

Parameters

datatype (str) – The datatype to check.

Returns

String containing the name of the referenced datatype.

Return type

str

caosdb.common.datatype.is_list_datatype(datatype)

returns whether the datatype is a list

caosdb.common.datatype.is_reference(datatype)

Returns whether the value is a reference

FILE and REFERENCE properties are examples, but also datatypes that are RecordTypes.

Parameters

datatype (str) – The datatype to check.

Returns

True if the datatype is a not base datatype or a list of a base datatype. Otherwise False is returned.

Return type

bool