ansisql.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:annotated-py-sqlalchemy 作者: hhstore 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号