Repository navigation
Scenario data read-path fixes and dataset_id index - #311
Merged
Merged
Conversation
- Index tResourceScenario.dataset_id (migration only creates it if no existing index leads with that column; InnoDB already indexes the FK). - get_scenario: add include_values flag so callers can skip the large tDataset.value column. - Scenario.get_data: keep include_results/type/value filters when recursing to the parent scenario instead of silently dropping them. - compare_scenarios: pass get_parent_data (include_parent_data was ignored by get_scenario) and skip value comparison when both sides reference the same dataset row. - update_resource_attribute: set the mapped attr_is_var column; the previous is_var assignment was a no-op.
Scenario.get_data, get_all_resourcescenarios and lib.scenario.get_scenario accept an optional attr_ids list, applied as ResourceAttr.attr_id IN (...) in the query, so callers needing a few attributes no longer load and build every resource scenario.
Keep this branch's scenario data read-path parameters, which include the attr_ids filter that master already has from #313, and re-parent the dataset_id index migration onto master's head so there is a single head.
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.
Summary
tResourceScenario.dataset_id. The migration only creates the index when none already leads with that column, since InnoDB indexes the FK automatically.get_scenario: newinclude_valuesflag (defaultTrue) to skip the largetDataset.valuecolumn when only structure is needed.Scenario.get_data: keepinclude_results, data-type and value filters when recursing to the parent scenario. They were previously dropped.compare_scenarios: passget_parent_data(include_parent_datawas silently ignored byget_scenario) and skip value comparison when both sides reference the same dataset row.update_resource_attribute: set the mappedattr_is_varcolumn. The previousis_varassignment was a no-op.Behaviour changes
compare_scenariosnow includes inherited parent data, as its docstring describes, so diffs for child scenarios may differ from before.update_resource_attributenow actually changes the flag.Testing
tests/test_scenario.py(37) andtests/attributes(63) pass on the SQLite test backend. No MySQL run, so the migration is untested against MySQL.Not included
Batching
update_resourcedata, the dedup hash change and dataset garbage collection are left for follow-up changes.