pg_lib.py 文件源码

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

项目:pg_ninja 作者: transferwise 项目源码 文件源码
def refresh_indices(self):
        self.logger.info("trying to create the indices on schemas %s and %s" %(self.pg_conn.dest_schema, self.pg_conn.schema_obf))
        for index in self.idx_ddl:
            idx_ddl= self.idx_ddl[index]
            for sql_idx in idx_ddl:
                path_clear = "SET search_path=%s;" % self.pg_conn.dest_schema
                path_obf = "SET search_path=%s;" % self.pg_conn.schema_obf

                sql_clear = "%s %s" %(path_clear , sql_idx)
                sql_obf = "%s %s" %(path_clear , path_obf)
                try:
                    self.logger.info("Executing %s on %s" %(sql_idx, self.pg_conn.dest_schema))
                    self.pg_conn.pgsql_cur.execute(sql_clear)
                except psycopg2.Error as e:
                    self.logger.error("SQLCODE: %s SQLERROR: %s" % (e.pgcode, e.pgerror))
                try:
                    self.logger.info("Executing %s on %s" %(sql_idx, self.pg_conn.schema_obf))
                    self.pg_conn.pgsql_cur.execute(sql_obf)
                except psycopg2.Error as e:
                    self.logger.error("SQLCODE: %s SQLERROR: %s" % (e.pgcode, e.pgerror))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号