Source

graphalchemy / graphalchemy / sessions.py

# -*- coding: utf-8 -*-
'''graph sessions'''

from graphalchemy.core import octopus, extend, call

__all__ = ['Session']
conf = octopus.G


class Session(octopus.workflow.Session):

    '''graph session'''

    # link manager
    links = extend(conf.direct.worker.link, conf.direct)
    # node monager
    nodes = extend(conf.model.worker.node, conf.models)
    # transaction monager
    transaction = call(conf.transaction, conf.userspace)

    def __exit__(self, e, b, c):
        with self.transaction:
            self.commit()