Skip to content

Commit 978114d

Browse files
committed
docs(autocommit): Provide autocommit usage example
1 parent 68e763b commit 978114d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ Basic Example
7474
print(result)
7575
>> (['One Hundred Years of Solitude', 'Gabriel García Márquez'], ['A Brief History of Time', 'Stephen Hawking'])
7676
77+
Enabling autocommit
78+
~~~~~~~~~~~~~~~~~~~
79+
**Following the DB-API specification, autocommit is off by default**. It can be turned on by using the autocommit property of the connection.
80+
81+
.. code-block:: py3
82+
83+
# Make sure we're not in a transaction
84+
con.rollback()
85+
con.autocommit = True
86+
con.run("VACUUM")
87+
con.autocommit = False
88+
7789
Example using IAM Credentials
7890
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7991
IAM Credentials can be supplied directly to ``connect(...)`` using an AWS profile as shown below:

0 commit comments

Comments
 (0)