Skip to content

Instantly share code, notes, and snippets.

View healiseu's full-sized avatar

HEALIS - Healthy Information Systems/Services healiseu

View GitHub Profile
@healiseu
healiseu / rom_upsert.py
Created July 29, 2018 15:53
Redis Object Mapper (ROM) - upsert operation
# (C) By Josiah Carlson
# https://github.com/josiahcarlson/rom/issues/116
#
def create_or_update(cls, data, **by):
entity = cls.get_by(**by)
if not entity:
entity = cls(**data)
else:
for k,v in data.items():
setattr(entity, k, v)

Leave your comments here

  • This is a HEALIS gist for feedback on the web site healis.eu
  • You can use Markup for on your comments