chore: include table name in SQLSerializable duplicate-key warning - #350
Merged
Conversation
Reported during real-QGIS testing: an emission calc for
EngineTestSource produced ~180 warnings all shaped like:
Already found entry with key 'None'. Replacing existing entry.
The message doesn't say WHICH SQL-backed table is producing the
duplicate keys, so tracing back to the culprit table requires
running under a debugger or grepping every SQLSerializable subclass.
Any of the reference tables loaded during a calc run (tbl_InvMeteo,
default_aircraft, default_aircraft_engine_ei, engine_test_events,
shapes_area_sources, etc.) could be the source.
Diagnostic upgrade: include self._table_name in the warning.
New shape:
Already found entry with key 'None' in table 'tbl_InvMeteo'.
Replacing existing entry.
Now the offending table is named at each occurrence, so a follow-up
audit of the schema for that specific table can proceed directly.
The str(key) cast is preserved as-is (already handled None properly).
Not touched
-----------
This is only a diagnostic upgrade. The underlying condition (some
table having a nullable or non-unique inferred primary key)
persists; each table where this fires still silently deduplicates
its in-memory entries down to one representative row per repeated
key. Fixing individual tables is separate follow-up work once the
warning names them.
Tests
-----
No new tests. The change is a log-format tweak; no test asserts the
old string (verified with grep). Existing test suite unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported during real-QGIS testing: an emission calc for EngineTestSource produced ~180 warnings all shaped like:
The message doesn't say WHICH SQL-backed table is producing the duplicate keys, so tracing back to the culprit table requires running under a debugger or grepping every SQLSerializable subclass. Any of the reference tables loaded during a calc run (tbl_InvMeteo, default_aircraft, default_aircraft_engine_ei, engine_test_events, shapes_area_sources, etc.) could be the source.
Diagnostic upgrade: include self._table_name in the warning. New shape:
Now the offending table is named at each occurrence, so a follow-up audit of the schema for that specific table can proceed directly.
The str(key) cast is preserved as-is (already handled None properly).
Not touched
This is only a diagnostic upgrade. The underlying condition (some table having a nullable or non-unique inferred primary key) persists; each table where this fires still silently deduplicates its in-memory entries down to one representative row per repeated key. Fixing individual tables is separate follow-up work once the warning names them.
Tests
No new tests. The change is a log-format tweak; no test asserts the old string (verified with grep). Existing test suite unaffected.