Skip to content

Commit

Permalink
add fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey committed Oct 31, 2023
1 parent 17d43d2 commit f893c30
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions crawlers/mooncrawl/mooncrawl/moonworm_crawler/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def deduplicate_records(
label name and label type work only for labels table.
"""

if table == "bloks":
if table == "blocks":
raise NotImplementedError("Deduplication for blocks is not implemented yet")

if table == "labels":
Expand Down Expand Up @@ -280,10 +280,11 @@ def deduplicate_records(
created_at ASC
)
DELETE FROM
{} USING lates_token_metadata
{} USING lates_labels
WHERE
label=:label
AND address=:address
AND label_data->>'type' = :label_type
AND {}.id not in (select id from lates_labels ) RETURNING {}.block_number;
""".format(
table, table, table, table
Expand Down Expand Up @@ -326,16 +327,19 @@ def deduplicate_records(
label=:label
AND address=:address
AND label_data->>'type' = :label_type
AND log_index is null
ORDER BY
transaction_hash ASC,
block_number ASC,
created_at ASC
)
DELETE FROM
{} USING lates_token_metadata
{} USING lates_labels
WHERE
label=:label
AND address=:address
AND label_data->>'type' = :label_type
AND log_index is null
AND {}.id not in (select id from lates_labels ) RETURNING {}.block_number;
""".format(
table, table, table, table
Expand Down

0 comments on commit f893c30

Please sign in to comment.