sdispater / eloquent

The Eloquent ORM provides a simple yet beautiful ActiveRecord implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use context manager for connections transactions

sdispater opened this issue · comments

Eloquent should support context managers for transactions.

with db.transaction() as transaction:
    transaction.table('users').insert({'name': 'foo', 'email': 'foo@bar.com'})

The syntax should actually be:

with db.transaction():
    db.table('users').insert({'name': 'foo', 'email': 'foo@bar.com'})