Skip to content

Commit

Permalink
Change documentation and update version.
Browse files Browse the repository at this point in the history
  • Loading branch information
pudo committed Jun 12, 2014
1 parent 75be7d3 commit 9a91f3d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*The changelog has only been started with version 0.3.12, previous
changes must be reconstructed from revision history.*

* 0.5.4: Context manager for transactions, thanks to @victorkashirin.
* 0.5.1: Fix a regression where empty queries would raise an exception.
* 0.5: Improve overall code quality and testing, including Travis CI.
An advanced __getitem__ syntax which allowed for the specification
Expand Down
13 changes: 8 additions & 5 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,17 @@ particular value, just use the auto-generated ``id`` column.
Using Transactions
------------------

You can group a set of database updates within a transaction, thus all updates are
committed at once or, in case of exception, all of them are reverted. Transactions are
supported by ``dataset`` context manager, and initiated by ``with`` statement::
You can group a set of database updates in a transaction. In that case, all updates
are committed at once or, in case of exception, all of them are reverted. Transactions
are supported through a context manager, so they can be used through a ``with``
statement::

with dataset.connect() as tx:
tx['user'].insert(dict(name='John Doe', age=46, country='China'))

You can get same functionality with datase methods :py:meth:`all() <dataset.Table.begin>`,
:py:meth:`all() <dataset.Table.commit>` and :py:meth:`rollback() <dataset.Table.rollback>`::
You can get same functionality by invocing the methods :py:meth:`begin() <dataset.Table.begin>`,
:py:meth:`commit() <dataset.Table.commit>` and :py:meth:`rollback() <dataset.Table.rollback>`
explicitly::

db = dataset.connect()
db.begin()
Expand All @@ -86,6 +88,7 @@ You can get same functionality with datase methods :py:meth:`all() <dataset.Tabl
db.rollback()

Nested transactions are supported too::

db = dataset.connect()
with db as tx1:
tx1['user'].insert(dict(name='John Doe', age=46, country='China'))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='dataset',
version='0.5.3',
version='0.5.4',
description="Toolkit for Python-based data processing.",
long_description="",
classifiers=[
Expand Down

0 comments on commit 9a91f3d

Please sign in to comment.