skip empty values importing urls and acronyms

This commit is contained in:
Michele Artini 2021-04-23 10:00:51 +02:00
parent bf28a0ba09
commit 303e1433ac
1 changed files with 6 additions and 5 deletions

View File

@ -32,12 +32,12 @@ ON CONFLICT DO NOTHING;
INSERT INTO acronyms(id, acronym) INSERT INTO acronyms(id, acronym)
SELECT 'pending_org_::'||MD5(local_id), oa_acronym FROM tmp_dedup_events SELECT 'pending_org_::'||MD5(local_id), oa_acronym FROM tmp_dedup_events
WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id AND oa_acronym IS NOT NULL AND oa_acronym != ''
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
INSERT INTO urls(id, url) INSERT INTO urls(id, url)
SELECT 'pending_org_::'||MD5(local_id), oa_url FROM tmp_dedup_events SELECT 'pending_org_::'||MD5(local_id), oa_url FROM tmp_dedup_events
WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id WHERE local_id NOT LIKE 'openorgs\_\_\_\_::%' AND local_id = oa_original_id AND oa_url IS NOT NULL AND oa_url != ''
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
INSERT INTO other_ids(id, otherid, type) INSERT INTO other_ids(id, otherid, type)
@ -57,14 +57,15 @@ WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%'
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
INSERT INTO acronyms(id, acronym) INSERT INTO acronyms(id, acronym)
SELECT oa_original_id, oa_acronym FROM tmp_dedup_events SELECT oa_original_id, oa_acronym
WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' FROM tmp_dedup_events
WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' AND oa_acronym IS NOT NULL AND oa_acronym != ''
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
INSERT INTO urls(id, url) INSERT INTO urls(id, url)
SELECT oa_original_id, oa_url SELECT oa_original_id, oa_url
FROM tmp_dedup_events FROM tmp_dedup_events
WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' WHERE oa_original_id NOT LIKE 'openorgs\_\_\_\_::%' AND oa_url IS NOT NULL AND oa_url != ''
ON CONFLICT DO NOTHING; ON CONFLICT DO NOTHING;
INSERT INTO other_ids(id, otherid, type) INSERT INTO other_ids(id, otherid, type)