Change documentation and update version.
This commit is contained in:
parent
75be7d3b62
commit
9a91f3d113
@ -3,6 +3,7 @@
|
|||||||
*The changelog has only been started with version 0.3.12, previous
|
*The changelog has only been started with version 0.3.12, previous
|
||||||
changes must be reconstructed from revision history.*
|
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.1: Fix a regression where empty queries would raise an exception.
|
||||||
* 0.5: Improve overall code quality and testing, including Travis CI.
|
* 0.5: Improve overall code quality and testing, including Travis CI.
|
||||||
An advanced __getitem__ syntax which allowed for the specification
|
An advanced __getitem__ syntax which allowed for the specification
|
||||||
|
|||||||
@ -67,15 +67,17 @@ particular value, just use the auto-generated ``id`` column.
|
|||||||
Using Transactions
|
Using Transactions
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
You can group a set of database updates within a transaction, thus all updates are
|
You can group a set of database updates in a transaction. In that case, all updates
|
||||||
committed at once or, in case of exception, all of them are reverted. Transactions are
|
are committed at once or, in case of exception, all of them are reverted. Transactions
|
||||||
supported by ``dataset`` context manager, and initiated by ``with`` statement::
|
are supported through a context manager, so they can be used through a ``with``
|
||||||
|
statement::
|
||||||
|
|
||||||
with dataset.connect() as tx:
|
with dataset.connect() as tx:
|
||||||
tx['user'].insert(dict(name='John Doe', age=46, country='China'))
|
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>`,
|
You can get same functionality by invocing the methods :py:meth:`begin() <dataset.Table.begin>`,
|
||||||
:py:meth:`all() <dataset.Table.commit>` and :py:meth:`rollback() <dataset.Table.rollback>`::
|
:py:meth:`commit() <dataset.Table.commit>` and :py:meth:`rollback() <dataset.Table.rollback>`
|
||||||
|
explicitly::
|
||||||
|
|
||||||
db = dataset.connect()
|
db = dataset.connect()
|
||||||
db.begin()
|
db.begin()
|
||||||
@ -86,6 +88,7 @@ You can get same functionality with datase methods :py:meth:`all() <dataset.Tabl
|
|||||||
db.rollback()
|
db.rollback()
|
||||||
|
|
||||||
Nested transactions are supported too::
|
Nested transactions are supported too::
|
||||||
|
|
||||||
db = dataset.connect()
|
db = dataset.connect()
|
||||||
with db as tx1:
|
with db as tx1:
|
||||||
tx1['user'].insert(dict(name='John Doe', age=46, country='China'))
|
tx1['user'].insert(dict(name='John Doe', age=46, country='China'))
|
||||||
|
|||||||
2
setup.py
2
setup.py
@ -8,7 +8,7 @@ if sys.version_info[:2] <= (2, 6):
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='dataset',
|
name='dataset',
|
||||||
version='0.5.3',
|
version='0.5.4',
|
||||||
description="Toolkit for Python-based data processing.",
|
description="Toolkit for Python-based data processing.",
|
||||||
long_description="",
|
long_description="",
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user