]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
since we aren't using text() in the DefaultClause we reflect, we need to unquote...
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 22 Jun 2009 21:27:10 +0000 (21:27 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 22 Jun 2009 21:27:10 +0000 (21:27 +0000)
reflection.  this is sqlite so far.  not quite sure what will happen with other dialects yet.

lib/sqlalchemy/dialects/sqlite/base.py
test/dialect/test_sqlite.py

index 20021158124a4ac412e5c33b848dc17d553b6bda..40c140569a029416a2e13ac3a31bcba3e4359de0 100644 (file)
@@ -408,6 +408,8 @@ class SQLiteDialect(default.DefaultDialect):
                 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 = re.sub(r'^\"|\"$', '', name)
+            if default:
+                default = re.sub(r"^\'|\'$", '', default)
             match = re.match(r'(\w+)(\(.*?\))?', type_)
             if match:
                 coltype = match.group(1)
@@ -424,6 +426,7 @@ class SQLiteDialect(default.DefaultDialect):
             if args is not None:
                 args = re.findall(r'(\d+)', args)
                 coltype = coltype(*[int(a) for a in args])
+
             columns.append({
                 'name' : name,
                 'type' : coltype,
index a582251c1f06c4e230eab21ad703889adef87b0e..32f8a9e0722a90d371a2bf1cb3fa75ee98aebf89 100644 (file)
@@ -158,7 +158,7 @@ class TestDefaults(TestBase, AssertsExecutionResults):
         db = testing.db
         m = MetaData(db)
 
-        expected = ["'my_default'", '0']
+        expected = ["my_default", '0']
         table = """CREATE TABLE r_defaults (
             data VARCHAR(40) DEFAULT 'my_default',
             val INTEGER NOT NULL DEFAULT 0