summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/sqlite.py
diff options
context:
space:
mode:
authorJonathan Ellis <jbellis@gmail.com>2006-07-27 04:56:15 +0000
committerJonathan Ellis <jbellis@gmail.com>2006-07-27 04:56:15 +0000
commit4c316c681726d3a5752162fe4aa33f858b774b4a (patch)
tree2f5130fd5e0aede101198b64ca3987d73d9ed493 /lib/sqlalchemy/databases/sqlite.py
parent3b41d5c63556179867b297faab05d9ff4e4e46fb (diff)
downloadsqlalchemy-4c316c681726d3a5752162fe4aa33f858b774b4a.tar.gz
PassiveDefault('?') for autoloaded sqlite defaults
(no complaints on-list so I'm checking this in... go ahead and revert if I'm stepping on any toes here, Mike)
Diffstat (limited to 'lib/sqlalchemy/databases/sqlite.py')
-rw-r--r--lib/sqlalchemy/databases/sqlite.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py
index c681f391a..361705b71 100644
--- a/lib/sqlalchemy/databases/sqlite.py
+++ b/lib/sqlalchemy/databases/sqlite.py
@@ -7,7 +7,7 @@
import sys, StringIO, string, types, re
-from sqlalchemy import sql, engine, schema, ansisql, exceptions, pool
+from sqlalchemy import sql, engine, schema, ansisql, exceptions, pool, PassiveDefault
import sqlalchemy.engine.default as default
import sqlalchemy.types as sqltypes
import datetime,time
@@ -178,7 +178,7 @@ class SQLiteDialect(ansisql.ANSIDialect):
break
#print "row! " + repr(row)
found_table = True
- (name, type, nullable, primary_key) = (row[1], row[2].upper(), not row[3], row[5])
+ (name, type, nullable, has_default, primary_key) = (row[1], row[2].upper(), not row[3], row[4], row[5])
match = re.match(r'(\w+)(\(.*?\))?', type)
coltype = match.group(1)
@@ -190,7 +190,11 @@ class SQLiteDialect(ansisql.ANSIDialect):
args = re.findall(r'(\d+)', args)
#print "args! " +repr(args)
coltype = coltype(*[int(a) for a in args])
- table.append_item(schema.Column(name, coltype, primary_key = primary_key, nullable = nullable))
+
+ colargs= []
+ if has_default:
+ colargs.append(PassiveDefault('?'))
+ table.append_item(schema.Column(name, coltype, primary_key = primary_key, nullable = nullable, *colargs))
if not found_table:
raise exceptions.NoSuchTableError(table.name)