Untitled
unknown
plain_text
2 years ago
1.5 kB
11
Indexable
# ...
for _, row in filtered_df.iterrows():
eprm_table_name = row['eprm_table_name']
eprm_join_cols_entity = row['eprm_join_cols_entity']
eprm_join_cols_reim = row['eprm_join_cols_reim']
eprm_table_alias = row['eprm_table_alias']
# Split the strings by ',' to get individual column assignments
columns_entity = eprm_join_cols_entity.split(',') if eprm_join_cols_entity else []
columns_reim = eprm_join_cols_reim.split(',') if eprm_join_cols_reim else []
# Compare the lengths of the column assignments
entity_length = len(columns_entity)
reim_length = len(columns_reim)
max_length = max(entity_length, reim_length)
# Pad the shorter list with empty elements to match the length of the longer list
columns_entity += [''] * (max_length - entity_length)
columns_reim += [''] * (max_length - reim_length)
# Construct the modified assignment string
assignment_string = ''
for col_entity, col_reim in zip(columns_entity, columns_reim):
# Extract the column name after '='
col_name_entity = col_entity.split('=')[0].strip()
col_name_reim = col_reim.split('=')[0].strip()
# Append the modified assignment to the string
assignment_string += f"{col_reim.replace(col_name_reim, eprm_table_alias + '.' + col_name_entity)}, "
# Remove the trailing comma and whitespace
assignment_string = assignment_string.rstrip(', ')
assignment_string = assignment_string.replace("AND", ",")
eprm_join_reim = assignment_string
# ...
Editor is loading...