#print "row! " + repr(row)
found_table = True
(name, type, nullable, has_default, primary_key) = (row[1], row[2].upper(), not row[3], row[4] is not None, row[5])
-
+ name = re.sub(r'^\"|\"$', '', name)
match = re.match(r'(\w+)(\(.*?\))?', type)
coltype = match.group(1)
args = match.group(2)
if row is None:
break
(constraint_name, tablename, localcol, remotecol) = (row[0], row[2], row[3], row[4])
+ tablename = re.sub(r'^\"|\"$', '', tablename)
+ localcol = re.sub(r'^\"|\"$', '', localcol)
+ remotecol = re.sub(r'^\"|\"$', '', remotecol)
try:
fk = fks[constraint_name]
except KeyError:
finally:
t.drop()
+ @testbase.supported('sqlite')
+ def test_goofy_sqlite(self):
+ testbase.db.execute("""CREATE TABLE "django_content_type" (
+ "id" integer NOT NULL PRIMARY KEY,
+ "django_stuff" text NULL
+ )
+ """)
+ testbase.db.execute("""
+ CREATE TABLE "django_admin_log" (
+ "id" integer NOT NULL PRIMARY KEY,
+ "action_time" datetime NOT NULL,
+ "content_type_id" integer NULL REFERENCES "django_content_type" ("id"),
+ "object_id" text NULL,
+ "change_message" text NOT NULL
+ )
+ """)
+ try:
+ meta = BoundMetaData(testbase.db)
+ table1 = Table("django_admin_log", meta, autoload=True)
+ table2 = Table("django_content_type", meta, autoload=True)
+ j = table1.join(table2)
+ assert j.onclause == table1.c.content_type_id==table2.c.id
+ finally:
+ testbase.db.execute("drop table django_admin_log")
+ testbase.db.execute("drop table django_content_type")
+
def testmultipk(self):
"""test that creating a table checks for a sequence before creating it"""
meta = BoundMetaData(testbase.db)