metadata.py 文件源码

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

项目:deb-python-cassandra-driver 作者: openstack 项目源码 文件源码
def export_as_string(self):
        """
        Returns a CQL query string that can be used to recreate the entire keyspace,
        including user-defined types and tables.
        """
        cql = "\n\n".join([self.as_cql_query() + ';']
                         + self.user_type_strings()
                         + [f.export_as_string() for f in self.functions.values()]
                         + [a.export_as_string() for a in self.aggregates.values()]
                         + [t.export_as_string() for t in self.tables.values()])
        if self._exc_info:
            import traceback
            ret = "/*\nWarning: Keyspace %s is incomplete because of an error processing metadata.\n" % \
                  (self.name)
            for line in traceback.format_exception(*self._exc_info):
                ret += line
            ret += "\nApproximate structure, for reference:\n(this should not be used to reproduce this schema)\n\n%s\n*/" % cql
            return ret
        return cql
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号