Get in touch
Get in touch

Create a new property on a class

create_property(class_name, prop_name, datatype, description, is_optional, is_array, is_nested, is_lang_string, inverse_of, enums, is_synonym, is_filterable, apply_to_subclasses)

Create a new property on a class.
Properties
NameTypeAttributesDefaultDescription
class_namestrClass to add the property to.
prop_namestrProperty name.
datatypeUnion[DATATYPE, str]A `DATATYPE` enum value for primitive types, or a class name string for object (relationship) properties.
descriptionstr<optional>''Human-readable description.
is_optionalbool<optional>TrueWhether the property is optional.
is_arraybool<optional>FalseWhether the property holds multiple values.
is_nestedbool<optional>FalseWhether an object property is nested (embedded).
is_lang_stringbool<optional>TrueFor text properties, whether to support multiple languages.
inverse_ofstr<optional>''Name of the inverse property on the target class (object properties only).
enumsOptional[list]<optional>Allowed values for DATATYPE.ENUM properties.
is_synonymbool<optional>FalseWhether this property is a label synonym.
is_filterablebool<optional>FalseWhether the property is available as a facet/filter.
apply_to_subclassesbool<optional>FalseIf True, also creates the property on all existing subclasses.
Returns:
None
Type
None
Raises:
ClassNotFoundError
If the class (or referenced class) does not exist.
PropertyExistsError
If a property with the same name already exists.
InvalidInversePropertyError
If the inverse property specification is invalid.