diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-07-28 11:53:18 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-07-28 11:53:18 -0400 |
| commit | 086ae95614b4848c486eeb7acf2bc1b03b2a6a37 (patch) | |
| tree | b54adc2f3a2402f23e2009cc50657937bfa3028e /lib/sqlalchemy/dialects/sqlite | |
| parent | 5c7cc274250c54430d9dceb05ad2a4a33e2378d7 (diff) | |
| download | sqlalchemy-086ae95614b4848c486eeb7acf2bc1b03b2a6a37.tar.gz | |
- SQLite dialect no longer strips quotes
off of reflected default value, allowing
a round trip CREATE TABLE to work.
This is consistent with other dialects
that also maintain the exact form of
the default. [ticket:2189]
Diffstat (limited to 'lib/sqlalchemy/dialects/sqlite')
| -rw-r--r-- | lib/sqlalchemy/dialects/sqlite/base.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index 331ab92d0..577b9a3a0 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -630,17 +630,19 @@ class SQLiteDialect(default.DefaultDialect): else: pragma = "PRAGMA " qtable = quote(table_name) - c = _pragma_cursor(connection.execute("%stable_info(%s)" % (pragma, qtable))) + c = _pragma_cursor( + connection.execute("%stable_info(%s)" % + (pragma, qtable))) found_table = False columns = [] while True: row = c.fetchone() if row is None: break - (name, type_, nullable, default, has_default, primary_key) = (row[1], row[2].upper(), not row[3], row[4], row[4] is not None, row[5]) + (name, type_, nullable, default, has_default, primary_key) = \ + (row[1], row[2].upper(), not row[3], + row[4], row[4] is not None, row[5]) name = re.sub(r'^\"|\"$', '', name) - if default: - default = re.sub(r"^\'|\'$", '', default) match = re.match(r'(\w+)(\(.*?\))?', type_) if match: coltype = match.group(1) |
