Skip to content

Fix MySQL not supporting unique_fields, add import_id#253

Open
ksy36 wants to merge 1 commit into
mainfrom
fix_mysql_uniq_fields
Open

Fix MySQL not supporting unique_fields, add import_id#253
ksy36 wants to merge 1 commit into
mainfrom
fix_mysql_uniq_fields

Conversation

@ksy36

@ksy36 ksy36 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

I've deployed the changes for importing country ranks and the import job fails with an error

django.db.utils.NotSupportedError: This database backend does not support updating conflicts with specifying unique fields that can trigger the upsert.

Looks like MySQL doesn't support unique_fields, so this PR fixes this.
Also added run_id instead of relying on updated_at=now()


if not partial and not to_upsert:
LOG.error("Full import produced 0 rows — skipping cleanup")
return

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is to make sure it doesn't delete all ranks if we received empty results from BQ for some reason

@ksy36
ksy36 requested a review from jgraham July 14, 2026 17:52

@skyschub skyschub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should drop MySQL and rebuild on PG eventually, but oh well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants