From: Mike Bayer Date: Sat, 3 Jan 2009 18:06:59 +0000 (+0000) Subject: identified the SQLite changes which affect default reflection X-Git-Tag: rel_0_5_0~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fcb1e97d9600a6d224072c0b62684ae8e8baa2f;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git identified the SQLite changes which affect default reflection --- diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py index 83dfc60f0a..1d89d1147c 100644 --- a/lib/sqlalchemy/databases/sqlite.py +++ b/lib/sqlalchemy/databases/sqlite.py @@ -490,10 +490,7 @@ class SQLiteDialect(default.DefaultDialect): colargs = [] if has_default: - try: - colargs.append(DefaultClause(sql.text(default))) - except: - colargs.append(DefaultClause(sql.text("what the heck is this: %r" % default))) + colargs.append(DefaultClause(sql.text(default))) table.append_column(schema.Column(name, coltype, primary_key = primary_key, nullable = nullable, *colargs)) if not found_table: diff --git a/test/dialect/sqlite.py b/test/dialect/sqlite.py index 9cedb5a2f4..97d12bf603 100644 --- a/test/dialect/sqlite.py +++ b/test/dialect/sqlite.py @@ -109,7 +109,6 @@ class TestTypes(TestBase, AssertsExecutionResults): expected = [len(c) > 1 and c[1] or c[0] for c in specs] for table in rt, rv: for i, reflected in enumerate(table.c): - print reflected.type, type(expected[i]) assert isinstance(reflected.type, type(expected[i])), type(expected[i]) finally: db.execute('DROP VIEW types_v') @@ -120,6 +119,8 @@ class TestTypes(TestBase, AssertsExecutionResults): class TestDefaults(TestBase, AssertsExecutionResults): __only_on__ = 'sqlite' + @testing.exclude('sqlite', '<', (3, 3, 8), + "sqlite3 changesets 3353 and 3440 modified behavior of default displayed in pragma table_info()") def test_default_reflection(self): # (ask_for, roundtripped_as_if_different) specs = [( String(3), '"foo"' ), @@ -144,6 +145,8 @@ class TestDefaults(TestBase, AssertsExecutionResults): finally: m.drop_all() + @testing.exclude('sqlite', '<', (3, 3, 8), + "sqlite3 changesets 3353 and 3440 modified behavior of default displayed in pragma table_info()") def test_default_reflection_2(self): db = testing.db m = MetaData(db) @@ -295,7 +298,6 @@ class InsertTest(TestBase, AssertsExecutionResults): table.insert().execute() rows = table.select().execute().fetchall() - print rows self.assertEquals(len(rows), wanted) finally: table.drop()