diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-16 17:20:18 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-02-16 17:20:18 -0500 |
| commit | 5e100a70c51362b522c8d4a05c0149c7d77672fb (patch) | |
| tree | ef92cedadf4a0277c247e39497f28ef7efa08cff /lib/sqlalchemy/dialects/sqlite/base.py | |
| parent | 79f801eae889ee6ee098ce3cd3b0ca98b852d2f5 (diff) | |
| download | sqlalchemy-5e100a70c51362b522c8d4a05c0149c7d77672fb.tar.gz | |
- The SQLite dialect will now skip unsupported arguments when reflecting
types; such as if it encounters a string like ``INTEGER(5)``, the
:class:`.INTEGER` type will be instantiated without the "5" being included,
based on detecting a ``TypeError`` on the first attempt.
Diffstat (limited to 'lib/sqlalchemy/dialects/sqlite/base.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/sqlite/base.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index b285bc8ca..a1bd05d38 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -867,7 +867,14 @@ class SQLiteDialect(default.DefaultDialect): coltype = self._resolve_type_affinity(coltype) if args is not None: args = re.findall(r'(\d+)', args) - coltype = coltype(*[int(a) for a in args]) + try: + coltype = coltype(*[int(a) for a in args]) + except TypeError: + util.warn( + "Could not instantiate type %s with " + "reflected arguments %s; using no arguments." % + (coltype, args)) + coltype = coltype() if default is not None: default = util.text_type(default) |
