pudo / dataset

Easy-to-use data handling for SQL data stores with support for implicit table creation, bulk loading, and transactions.
https://dataset.readthedocs.org/
MIT License
4.76k stars 297 forks source link

When the transaction is finished, why the connection is not explicitly closed? #242

Closed liqueur closed 6 years ago

liqueur commented 6 years ago

the transaction wrapper in database.py

def __exit__(self, error_type, error_value, traceback):
    """End a transaction by committing or rolling back."""
    if error_type is None:
        try:
            self.commit()
        except:
            with safe_reraise():
                self.rollback()
    else:
        self.rollback()