conProd = psycopg2.connect(host=mapeamento.prod_host, database=mapeamento.prod_banco, user=mapeamento.prod_usuario, password=mapeamento.prod_senha, port=mapeamento.prod_porta) curProd = conProd.cursor() sql = "select id_fluxo, ds_fluxo, ds_xml from core.tb_fluxo where in_ativo = true and ds_xml LIKE %s" query = curCand.mogrify(sql, ('%<assignment pooled-actors="#"%', )) curCand.execute(query) conCand.commit() recset = curCand.fetchall() for rec in recset: xml_cand = rec[2] nome_arquivo = "/Cand__"+rec[1]+"__.txt" arquivo = Arquivos() arquivo.salvar_fluxo(mapeamento.nome, xml_cand, nome_arquivo) sqlProd = "select ds_fluxo, ds_xml from core.tb_fluxo where id_fluxo = %s" queryProd = curProd.mogrify(sqlProd, (rec[0], )) curProd.execute(queryProd) rec_set_prod = curProd.fetchall() for rec_prod in rec_set_prod: xml_prod = rec_prod[1] nome_arquivo = "/Prod__"+rec[1]+"__.txt" arquivo = Arquivos() arquivo.salvar_fluxo(mapeamento.nome, xml_prod, nome_arquivo) print('Fluxo alterado ' + str(rec[1]))