Untitled

 avatar
unknown
plain_text
2 years ago
1.3 kB
5
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(',')
    columns_reim = eprm_join_cols_reim.split(',')

    # Compare the lengths of the column assignments
    if len(columns_entity) != len(columns_reim):
        # Concatenate missing fields from entity to the end of the columns_reim list
        columns_reim += [column.strip() for column in columns_entity[len(columns_reim):]]

    # Construct the modified assignment string
    assignment_string = ''
    for col_reim in columns_reim:
        # Extract the column name after '='
        col_name = col_reim.split('=')[0].strip()
        # Append the modified assignment to the string
        assignment_string += f"{col_reim.replace(col_name, eprm_table_alias + '.' + col_name)}, "

    # 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...