Updates for IDAA Cvent API sync. Less debugging turned on.

This commit is contained in:
Scott Idem
2022-03-15 11:59:40 -04:00
parent 243561e3b7
commit 4752c81e7f
6 changed files with 70 additions and 39 deletions

View File

@@ -123,7 +123,7 @@ async def importing_update_w_external_id(
FROM `v_person` AS `person`
WHERE person.account_id = :account_id
AND person.email = :email
AND (external_id IS NULL OR external_import_id IS NULL)
AND (external_id IS NULL OR external_sys_id IS NULL)
LIMIT 1;
"""
@@ -138,15 +138,15 @@ async def importing_update_w_external_id(
# address_id = person_rec.get('address_id', None)
# user_id = person_rec.get('user_id', None)
# external_id = person_rec.get('external_id', None)
# external_import_id = person_rec.get('external_import_id', None)
# external_sys_id = person_rec.get('external_sys_id', None)
person_data = {}
person_data['id'] = person_id
person_data['external_id'] = external_id
if source_id:
person_data['external_import_id'] = source_id
person_data['external_sys_id'] = source_id
else:
person_data['external_import_id'] = email
person_data['external_sys_id'] = email
log.debug(person_data)
if person_obj_up_result := sql_update(data=person_data, table_name='person'):
@@ -337,11 +337,11 @@ async def ins_up_person_contact_address_user_data(
person_data = {}
person_data['external_id'] = external_id
if source_id:
person_data['external_import_id'] = source_id
person_data['external_sys_id'] = source_id
else:
person_data['external_import_id'] = email
external_import_id = person_data['external_import_id']
log.debug(external_import_id)
person_data['external_sys_id'] = email
external_sys_id = person_data['external_sys_id']
log.debug(external_sys_id)
if record.get('informal_name'): person_data['informal_name'] = record.get('informal_name')
if record.get('given_name'): person_data['given_name'] = record.get('given_name')
@@ -434,12 +434,12 @@ async def ins_up_person_contact_address_user_data(
data = {}
data['account_id'] = account_id
data['external_id'] = external_id
data['external_import_id'] = external_import_id
data['external_sys_id'] = external_sys_id
# sql = f"""
# SELECT *
# FROM `v_person` AS `person`
# WHERE person.account_id = :account_id
# AND person.external_import_id = :external_import_id
# AND person.external_sys_id = :external_sys_id
# LIMIT 1;
# """
@@ -895,11 +895,11 @@ async def ins_up_membership_person_data(
person_data = {}
if source_id:
person_data['external_import_id'] = source_id
person_data['external_sys_id'] = source_id
else:
person_data['external_import_id'] = email
external_import_id = person_data['external_import_id']
log.debug(external_import_id)
person_data['external_sys_id'] = email
external_sys_id = person_data['external_sys_id']
log.debug(external_sys_id)
if membership_type_name := record.get('membership_type', None): pass
else:
@@ -909,13 +909,13 @@ async def ins_up_membership_person_data(
data = {}
data['account_id'] = account_id
data['external_id'] = external_id
data['external_import_id'] = external_import_id
data['external_sys_id'] = external_sys_id
sql = f"""
SELECT *
FROM `v_person` AS `person`
WHERE person.account_id = :account_id
AND person.external_id = :external_id
/*AND person.external_import_id = :external_import_id*/
/*AND person.external_sys_id = :external_sys_id*/
LIMIT 1;
"""
@@ -1096,7 +1096,7 @@ async def importing_person_data(
account_id = 99
full_file_path = 'admin/temp/import_person_data.xlsx'
df = pandas.read_excel(full_file_path, na_filter=False, dtype={'external_import_id': str, 'phone_home': str, 'phone_mobile': str, 'city': str, 'state_province': str, 'address_postal_code': str, 'country': str})
df = pandas.read_excel(full_file_path, na_filter=False, dtype={'external_sys_id': str, 'phone_home': str, 'phone_mobile': str, 'city': str, 'state_province': str, 'address_postal_code': str, 'country': str})
#df = df.fillna('') # replace NaN with ''
# df = df.fillna(None)
# df = df.fillna('', inplace=True)
@@ -1118,10 +1118,10 @@ async def importing_person_data(
user_id = None
person_data = {}
if record['external_import_id']:
person_data['external_import_id'] = record['external_import_id']
if record['external_sys_id']:
person_data['external_sys_id'] = record['external_sys_id']
else:
person_data['external_import_id'] = record['email']
person_data['external_sys_id'] = record['email']
# person_data['informal_name'] = record['informal_name']
person_data['given_name'] = record['given_name']
if record['middle_name']:
@@ -1174,7 +1174,7 @@ async def importing_person_data(
log.debug(person_data)
# log.debug('*** *** *** *** END TEST RUN *** *** *** ***')
# continue
if person_rec_li_result := sql_select(table_name='v_person', field_name='external_import_id', field_value=person_data['external_import_id']):
if person_rec_li_result := sql_select(table_name='v_person', field_name='external_sys_id', field_value=person_data['external_sys_id']):
if not isinstance(person_rec_li_result, list):
# Pull out IDs and UPDATE existing person record
log.debug('Found one record')
@@ -1417,7 +1417,7 @@ async def importing_cont_edu_cert_person_data(
cont_edu_cert_id = 3
full_file_path = 'admin/temp/import_cont_edu_cert_person_data.xlsx'
df = pandas.read_excel(full_file_path, na_filter=False, dtype={'external_import_id': str, 'phone_home': str, 'phone_mobile': str, 'city': str, 'state_province': str, 'address_postal_code': str, 'country': str})
df = pandas.read_excel(full_file_path, na_filter=False, dtype={'external_sys_id': str, 'phone_home': str, 'phone_mobile': str, 'city': str, 'state_province': str, 'address_postal_code': str, 'country': str})
log.debug(df)
df_dict = df.to_dict(orient='records')
@@ -1549,7 +1549,7 @@ async def importing_cont_edu_cert_person_data_touch(
cont_edu_cert_id = 3
full_file_path = 'admin/temp/import_cont_edu_cert_person_data.xlsx'
df = pandas.read_excel(full_file_path, na_filter=False, dtype={'external_import_id': str, 'phone_home': str, 'phone_mobile': str, 'city': str, 'state_province': str, 'address_postal_code': str, 'country': str})
df = pandas.read_excel(full_file_path, na_filter=False, dtype={'external_sys_id': str, 'phone_home': str, 'phone_mobile': str, 'city': str, 'state_province': str, 'address_postal_code': str, 'country': str})
log.debug(df)
df_dict = df.to_dict(orient='records')