in modular_sdk/services/parent_service.py [0:0]
def update(parent: Parent, attributes: List, updated_by: str):
updatable_attributes = [
Parent.description,
Parent.meta,
Parent.type,
Parent.updated_by,
Parent.is_deleted,
Parent.type_scope
]
actions = []
for attribute in attributes:
if attribute not in updatable_attributes:
_LOG.warning(f'Attribute {attribute.attr_name} '
f'can\'t be updated.')
continue
python_attr_name = Parent._dynamo_to_python_attr(
attribute.attr_name)
update_value = getattr(parent, python_attr_name)
actions.append(attribute.set(update_value))
actions.append(Parent.updated_by.set(updated_by))
actions.append(
Parent.update_timestamp.set(int(utc_datetime().timestamp() * 1e3)))
parent.update(actions=actions)