I'm looking at this bit of code in `target-postgre...
# singer-target-development
c
I'm looking at this bit of code in `target-postgres`: https://github.com/MeltanoLabs/target-postgres/blob/d07b41583e8ff77ee770a0d40779ea9485772461/target_postgres/sinks.py#L161-L169
Copy code
for record in records:
    insert_record = {column.name: record.get(column.name) for column in columns}
    # No need to check for a KeyError here because the SDK already
    # guarantees that all key properties exist in the record.
    primary_key_value = "".join([str(record[key]) for key in primary_keys])
    insert_records[primary_key_value] = insert_record
Wouldn't this potentially cause with records being erroneously thrown out? We are just concatenating the values of the primary keys to check for duplication. So the following would be equivalent: Record 1: • Primary Key #1: AB • Primary Key #2: C Record 2: • Primary Key #1: A • Primary Key #2: BC
e
I think so. A tuple might just be better.
🎯 1
v
PRs welcome 🙂
c
@Edgar Ramírez (Arch.dev) Agreed with tuples
@visch Planning on issuing a PR, but I wanted to sanity check
v
I've never hit the use case you're talking about or even close, but definitely possible
c
I do want to see if there's a way to accomplish this without building another list, but I can't think of one.