diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-09-20 09:25:40 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-09-21 16:41:47 -0400 |
| commit | adb495503dab660f014cad0200491c854d2f6a50 (patch) | |
| tree | 574add6718deee3da9f4dc9d3ad57057420ad1fd /lib/sqlalchemy/util | |
| parent | 6cfbd5fefef51374d3c60fb58e094db00643faa0 (diff) | |
| download | sqlalchemy-adb495503dab660f014cad0200491c854d2f6a50.tar.gz | |
Support SQLite URIs
Added support for sqlite "URI" connections, which allow for sqlite-specific
flags to be passed in the query string such as "read only" for Python
sqlite3 drivers that support this.
Fixes: #4863
Change-Id: I7740b55ee8f2ede72a5c49ee94a7540e4d0250f2
Diffstat (limited to 'lib/sqlalchemy/util')
| -rw-r--r-- | lib/sqlalchemy/util/langhelpers.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index f3f3f9ea5..83f119660 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -1126,21 +1126,24 @@ def asint(value): return int(value) -def coerce_kw_type(kw, key, type_, flexi_bool=True): +def coerce_kw_type(kw, key, type_, flexi_bool=True, dest=None): r"""If 'key' is present in dict 'kw', coerce its value to type 'type\_' if necessary. If 'flexi_bool' is True, the string '0' is considered false when coercing to boolean. """ + if dest is None: + dest = kw + if ( key in kw and (not isinstance(type_, type) or not isinstance(kw[key], type_)) and kw[key] is not None ): if type_ is bool and flexi_bool: - kw[key] = asbool(kw[key]) + dest[key] = asbool(kw[key]) else: - kw[key] = type_(kw[key]) + dest[key] = type_(kw[key]) def constructor_key(obj, cls): |
