managers.py 文件源码

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

项目:django-calaccess-processed-data 作者: california-civic-data-coalition 项目源码 文件源码
def load_raw_data(self):
        """
        Load the model by executing its raw sql load query.

        Temporarily drops any constraints or indexes on the model.
        """
        try:
            self.drop_constraints_and_indexes()
        except ValueError as e:
            print(e)
            print('Constrained fields: %s' % self.constrained_fields)
            print('Indexed fields: %s' % self.indexed_fields)
            dropped = False
        else:
            dropped = True

        c = connection.cursor()
        try:
            c.execute(self.raw_data_load_query)
        finally:
            c.close()
            if dropped:
                self.add_constraints_and_indexes()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号