|
@ -23,6 +23,7 @@ def migra_autor(db, passwd): |
|
|
group by cod_autor;").format(db) |
|
|
group by cod_autor;").format(db) |
|
|
cursor.execute(query2) |
|
|
cursor.execute(query2) |
|
|
user = [] |
|
|
user = [] |
|
|
|
|
|
|
|
|
for response in cursor: |
|
|
for response in cursor: |
|
|
user.append(response) |
|
|
user.append(response) |
|
|
|
|
|
|
|
@ -37,10 +38,15 @@ def migra_autor(db, passwd): |
|
|
|
|
|
|
|
|
tables = ['autoria', 'documento_administrativo', 'proposicao', 'protocolo'] |
|
|
tables = ['autoria', 'documento_administrativo', 'proposicao', 'protocolo'] |
|
|
for table in tables: |
|
|
for table in tables: |
|
|
query3 = ("UPDATE {}.{} SET cod_autor = {} WHERE cod_autor in ").format(db, table, ativ[0][0]) |
|
|
# Para update e delete no MySQL -> SET SQL_SAFE_UPDATES = 0; |
|
|
|
|
|
query3 = ("update {}.{} set cod_autor = {} where cod_autor in ").format(db, table, ativ[0][0]) |
|
|
inativIds = [u[0] for u in inativ] |
|
|
inativIds = [u[0] for u in inativ] |
|
|
inativIds = (str(inativIds)).replace(']', ')').replace('[', '(') |
|
|
inativIds = (str(inativIds)).replace(']', ')').replace('[', '(') |
|
|
query3 += inativIds |
|
|
query3 += inativIds + ';' |
|
|
|
|
|
#cursor.execute(query3) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cursor.execute(query3) |
|
|
query4 = ("delete from sapl_cm_ere_cpy.autor \ |
|
|
|
|
|
where cod_autor in ") |
|
|
|
|
|
query4 += inativIds + ';' |
|
|
|
|
|
|