'vietnamien':'VN', 'vietnamienne':'VN', 'yemenite':'YE', 'zimbabwéenne':'ZW', 'égyptien':'EG', 'égyptiene':'EG', 'étasunienne':'US', 'états-unienne':'US', 'étatstunienne':'US', 'étatsunienne':'US', 'étatsunnienne':'US', } try: lgc_4_1 = lgc_4_1_connect() lgc_v5 = lgc_5_connect() except Exception as e: print(e) print('exiting...') exit() cursor4 = lgc_4_1.cursor() cursor5 = lgc_v5.cursor() cursor4.execute("SELECT * FROM personne") now = datetime.now() formatted_date = now.strftime('%Y-%m-%d %H:%M:%S') row = cursor4.fetchone() while row is not None:
#!/usr/bin/python3 import mysql.connector from datetime import datetime from migration_common import lgc_5_connect, lgc_4_1_connect import pdb print('importing responsibles...') try: lgc_4_1 = lgc_4_1_connect() lgc_v5 = lgc_5_connect() lgc_v5_user = lgc_5_connect() except Exception as e: print(e) print('exiting...') exit() cursor4 = lgc_4_1.cursor() cursor5 = lgc_v5.cursor() cursor5_user = lgc_v5_user.cursor() cursor4.execute("SELECT * FROM responsable") row = cursor4.fetchone() while row is not None: try: first_name, last_name = row[1].split('.') except: first_name = last_name = row[1] cursor5_user.execute(
#!/usr/bin/python3 # https://pynative.com/python-mysql-tutorial/ import mysql.connector from datetime import datetime from migration_common import em, lgc_5_connect import pdb print('fixing file description...') try: lgc_v5 = lgc_5_connect() lgc_v5_update = lgc_5_connect() except Exception as e: print(e) print('exiting...') exit() cursor5 = lgc_v5.cursor() cursor5.execute("SELECT id,comments FROM lgc_person") cursor5_update = lgc_v5_update.cursor() row = cursor5.fetchone() while row is not None: if row[1] == None or row[1].find('"') < 0: row = cursor5.fetchone() continue print('fixing id:', row[0]) comments = row[1].replace('"', '"') sql_update_query = """UPDATE `lgc_person` SET comments = %s WHERE id = %s""" sql_update_tuple = (comments, row[0])
from datetime import datetime from migration_common import lgc_5_connect, lgc_4_1_connect import pdb, os, sys, django sys.path.append("..") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lgc_base.settings") django.setup() from lgc.models import Invoice import logging print('importing items...') try: lgc_4_1 = lgc_4_1_connect() lgc_4_1_tarif = lgc_4_1_connect() lgc_v5 = lgc_5_connect() lgc_v5_invoice = lgc_5_connect() except Exception as e: print(e) print('exiting...') exit() cursor4 = lgc_4_1.cursor() cursor4_tarif = lgc_4_1_tarif.cursor() cursor5 = lgc_v5.cursor() cursor5_invoice = lgc_v5_invoice.cursor() cursor4.execute("SELECT * FROM diligence") row = cursor4.fetchone() while row is not None: cursor4_tarif.execute('select * from tarif_dil where id_dil=%d' % (row[0]))