Skip to content

Commit

Permalink
Deprecation warning when specifying autocommit in db constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
coleifer committed Feb 1, 2018
1 parent 41180d6 commit cc7221f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion peewee.py
Original file line number Diff line number Diff line change
Expand Up @@ -2354,7 +2354,7 @@ class Database(_callable_context_manager):
sequences = False

def __init__(self, database, thread_safe=True, autorollback=False,
field_types=None, operations=None, **kwargs):
field_types=None, operations=None, autocommit=None, **kwargs):
self._field_types = merge_dict(FIELD, self.field_types)
self._operations = merge_dict(OP, self.operations)
if field_types:
Expand All @@ -2371,6 +2371,16 @@ def __init__(self, database, thread_safe=True, autorollback=False,
self._state = _ConnectionState()
self._lock = _NoopLock()

if autocommit is not None:
__deprecated__('Peewee no longer uses the "autocommit" option, as '
'the semantics now require it to always be True. '
'Because some database-drivers also use the '
'"autocommit" parameter, you are receiving a '
'warning so you may update your code and remove '
'the parameter, as in the future, specifying '
'autocommit could impact the behavior of the '
'database driver you are using.')

self.connect_params = {}
self.init(database, **kwargs)

Expand Down

0 comments on commit cc7221f

Please sign in to comment.