Untitled
unknown
plain_text
2 years ago
1.8 kB
4
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) if entity_length != reim_length: # If entity columns are fewer, repeat the last column assignment to match the length of columns_reim if entity_length < reim_length: columns_entity += [columns_entity[-1]] * (reim_length - entity_length) # If entity columns are more, repeat the last column assignment to match the length of columns_entity else: columns_reim += [columns_reim[-1]] * (entity_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...