I have an existing repository connected to MySQL. Details have been omitted for clarity.
class Person(object):
def __init__(self):
# This is entity is mapped to the DB using SQLAlchemy's classical mapping.
It also includes an Address
pass
class Address(object):
def __init__(self):
pass
class PersonRepository(object):
def __init__(self, DBSession):
self.session = DBSession
def persist(self, entity):
self.session.add(entity)
self.session.flush()
return entity
class AddressEditor(object):
def __init__(self):
pass
def add_address(self, person, address):
person.address = address
#We can either inject the session into this method, or
#obtain it from a configuration file.
repository = PersonRepository(DBSession)
person = repository.persist(person)
return person.address
I want to convert the repository to ElasticSearch. What is the best way to move forward?