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
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
class_name | str | Class to add the property to. | ||
prop_name | str | Property name. | ||
datatype | Union[DATATYPE, str] | A `DATATYPE` enum value for primitive types, or a class name string for object (relationship) properties. | ||
description | str | <optional> | '' | Human-readable description. |
is_optional | bool | <optional> | True | Whether the property is optional. |
is_array | bool | <optional> | False | Whether the property holds multiple values. |
is_nested | bool | <optional> | False | Whether an object property is nested (embedded). |
is_lang_string | bool | <optional> | True | For text properties, whether to support multiple languages. |
inverse_of | str | <optional> | '' | Name of the inverse property on the target class (object properties only). |
enums | Optional[list] | <optional> | Allowed values for DATATYPE.ENUM properties. | |
is_synonym | bool | <optional> | False | Whether this property is a label synonym. |
is_filterable | bool | <optional> | False | Whether the property is available as a facet/filter. |
apply_to_subclasses | bool | <optional> | False | If 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.