diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-08-08 23:34:20 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-08-08 23:52:51 -0400 |
| commit | 104e6907284e602a8485f32fc67fd6af0c00e4d0 (patch) | |
| tree | fd628fbc353341fa31953b5f55be98b9748e6bea /lib/sqlalchemy/dialects/sqlite/base.py | |
| parent | d8da7f5ac544f3dd853a221faa5fab4ff788e25b (diff) | |
| download | sqlalchemy-104e6907284e602a8485f32fc67fd6af0c00e4d0.tar.gz | |
Correct name for json_serializer / json_deserializer, document and test
The dialects that support json are supposed to take arguments
``json_serializer`` and ``json_deserializer`` at the create_engine() level,
however the SQLite dialect calls them ``_json_serilizer`` and
``_json_deserilalizer``. The names have been corrected, the old names are
accepted with a change warning, and these parameters are now documented as
:paramref:`.create_engine.json_serializer` and
:paramref:`.create_engine.json_deserializer`.
Fixes: #4798
Change-Id: I1dbfe439b421fe9bb7ff3594ef455af8156f8851
Diffstat (limited to 'lib/sqlalchemy/dialects/sqlite/base.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/sqlite/base.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index ef8507d05..78ce18ac6 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -1426,18 +1426,39 @@ class SQLiteDialect(default.DefaultDialect): _broken_fk_pragma_quotes = False _broken_dotted_colnames = False + @util.deprecated_params( + _json_serializer=( + "1.3.7", + "The _json_serializer argument to the SQLite dialect has " + "been renamed to the correct name of json_serializer. The old " + "argument name will be removed in a future release.", + ), + _json_deserializer=( + "1.3.7", + "The _json_deserializer argument to the SQLite dialect has " + "been renamed to the correct name of json_deserializer. The old " + "argument name will be removed in a future release.", + ), + ) def __init__( self, isolation_level=None, native_datetime=False, + json_serializer=None, + json_deserializer=None, _json_serializer=None, _json_deserializer=None, **kwargs ): default.DefaultDialect.__init__(self, **kwargs) self.isolation_level = isolation_level - self._json_serializer = _json_serializer - self._json_deserializer = _json_deserializer + + if _json_serializer: + json_serializer = _json_serializer + if _json_deserializer: + json_deserializer = _json_deserializer + self._json_serializer = json_serializer + self._json_deserializer = json_deserializer # this flag used by pysqlite dialect, and perhaps others in the # future, to indicate the driver is handling date/timestamp |
