Open Lefort-Antoine opened 1 year ago
Hi @Lefort-Antoine ! Sorry for the delay, I'll look into your different issues.
Hy Could you have a look on the issues please @ccruveiller ?
Found a way. Still searching best one.
self.db.loc._dev_schema._declared_fields["insee"].metadata
I add for each Record ` @classmethod def get_metadata(cls): return {field : cls.Schema._declared_fields[field].metadata for field in cls.Schema._declared_fields}
`
Could be interesting for next version ?
Hi metadata can be handled and here is an example to extract a records metadata:
db = AppFields()
# check correct value
country_mapping_d = {"france": True, "spain": False}
db.immutable_dict_field_record.add(ref="hello", country_map=country_mapping_d)
metadata_d = db.immutable_dict_field_record.one().get_metadata_dict()
Also metadata fields can directly be declared through record's field attributes, ex:
loop_design_temperature_difference = fields.Float(
missing=7,
### these attributes are metadata
description="Design loop design temperature difference used for autosizing",
topic="Sizing",
eplus_usage="Sizing:Plant",
)
Hy
How can I get metadata ?
In this example I found no way to get the metadata of the records loc2.
`from omemdb import Db, Record from omemdb.packages.omarsh import Schema, fields, validate, ValidationError
`
Regards