def visit_table(self, table):
self.append("\nCREATE TABLE " + table.fullname + "(")
separator = "\n"
# if only one primary key, specify it along with the column
pks = table.primary_key
first_pk = False
for column in table.columns:
self.append(separator)
separator = ", \n"
self.append("\t" + self.get_column_specification(column, override_pk=len(pks)>1, first_pk=column.primary_key and not first_pk))
if column.primary_key:
first_pk = True
# if multiple primary keys, specify it at the bottom
if len(pks) > 1:
self.append(", \n")
self.append("\tPRIMARY KEY (%s)" % string.join([c.name for c in pks],', '))
self.append("\n)%s\n\n" % self.post_create_table(table))
self.execute()
评论列表
文章目录