diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-01-19 16:32:36 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-01-19 16:32:36 -0500 |
commit | 3dc9f9b3db10254f688c6b25b58951a4b1d4a41b (patch) | |
tree | ebd64997f00c20676d898e4ebcb8f953eb3f4d14 /lib/sqlalchemy/sql/base.py | |
parent | 8e1a4fdced253a58af309c93c24a8a492b646bb7 (diff) | |
download | sqlalchemy-3dc9f9b3db10254f688c6b25b58951a4b1d4a41b.tar.gz |
- alter behavior such that dialect_kwargs is still immutable, but
now represents exactly the kwargs that were passed, and not the defaults.
the defaults are still in dialect_options. This allows repr() schemes such as that
of alembic to not need to look through and compare for defaults.
Diffstat (limited to 'lib/sqlalchemy/sql/base.py')
-rw-r--r-- | lib/sqlalchemy/sql/base.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py index f4bfe392a..4a7dd65d3 100644 --- a/lib/sqlalchemy/sql/base.py +++ b/lib/sqlalchemy/sql/base.py @@ -56,7 +56,9 @@ class DialectKWArgs(object): options to this construct. The arguments are present here in their original ``<dialect>_<kwarg>`` - format. + format. Only arguments that were actually passed are included; + unlike the :attr:`.DialectKWArgs.dialect_options` collection, which + contains all options known by this dialect including defaults. .. versionadded:: 0.9.2 @@ -66,14 +68,7 @@ class DialectKWArgs(object): """ - return util.immutabledict( - ( - "%s_%s" % (dialect_name, kwarg_name), - kw_dict[kwarg_name] - ) - for dialect_name, kw_dict in self.dialect_options.items() - for kwarg_name in kw_dict if kwarg_name != '*' - ) + return util.immutabledict() @property def kwargs(self): @@ -128,7 +123,7 @@ class DialectKWArgs(object): if not kwargs: return - self.__dict__.pop('dialect_kwargs', None) + self.dialect_kwargs = self.dialect_kwargs.union(kwargs) for k in kwargs: m = re.match('^(.+?)_(.+)$', k) |