Example #1
0
 def test_create_table_sql(self):
     expected_sql = "CREATE TABLE foreign_key_table (" \
                    "basic_id INTEGER, " \
                    "id INTEGER PRIMARY KEY AUTOINCREMENT, " \
                    "really_basic_id INTEGER, " \
                    "FOREIGN KEY(basic_id) " \
                    "REFERENCES basic_table(id), " \
                    "FOREIGN KEY(really_basic_id) " \
                    "REFERENCES really_basic_table(id));"
     actual_sql = sqlgen.create_table_sql(self.foreign_key_table)
     self.assertEqual(expected_sql, actual_sql)
Example #2
0
def create_table(c, table):
    sql = sqlgen.create_table_sql(table)
    c.execute(sql)