Skip to content

Extra columns name and key column with different names for the second table to compare data from. #10

Closed Answered by Ryuk-me
Ryuk-me asked this question in Q&A
Discussion options

You must be logged in to vote
from reladiff import connect_to_table, diff_tables

table1 = connect_to_table(
    "postgresql://postgres:password@localhost:5432/dvdrental",
    "actor",
    "actor_id",
    extra_columns=(
        "first_name",
        "last_name",
        "last_update",
    ),
)
table2 = connect_to_table(
    "postgresql://postgres:password@localhost:5432/dvdrental2",
    "actor2",
    "actor_id1",
    extra_columns=(
        "first_name1",
        "last_name1",
        "last_update1",
    ),
)

for sign, row in diff_tables(table1, table2):
    print(sign, row)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@erezsh
Comment options

Answer selected by Ryuk-me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants