neuralib.sqlp.cli.transaction

neuralib.sqlp.cli.transaction()[source]

A decorator that decorate a function as a transaction session that open a connection and set to the global variable.

>>> @transaction
... def example(self):
...     self.do_something()

equalivent to

>>> def example(self):
...     with self.open_connection():
...         self.do_something()