Skip to content

Push template_id filter into SQL in get_all_resource_attributes - #286

Merged
knoxsp merged 3 commits into
improve_get_network_attributesfrom
copilot/sub-pr-284-again
Mar 9, 2026
Merged

Push template_id filter into SQL in get_all_resource_attributes#286
knoxsp merged 3 commits into
improve_get_network_attributesfrom
copilot/sub-pr-284-again

Conversation

Copilot AI commented Mar 9, 2026

Copy link
Copy Markdown
Contributor
  • Understand template inheritance via get_template() / get_types()
  • Replace direct TypeAttr/TemplateType DB query with get_template() call so inherited type attributes are included
  • Code review and security scan passed

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: knoxsp <9108420+knoxsp@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP: Address feedback on improving get network attributes Push template_id filter into SQL in get_all_resource_attributes Mar 9, 2026
# If a template_id is provided, retrieve the relevant attr_ids up front
# so the filter can be applied at the SQL level in each query branch below.
attr_ids = None
if template_id is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will not work due to the inheritance structure in templates.
You need to call the get_template function in the template module to return the full inherited template structure, then extract the type attributes from there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in c798865. The direct TypeAttr/TemplateType DB query is replaced with a call to get_template(), which walks the full inheritance tree via get_types(). The attr_ids are then extracted from all templatetypes (including inherited ones) and applied as the SQL-level filter — matching the same pattern used in get_template_attributes().

Co-authored-by: knoxsp <9108420+knoxsp@users.noreply.github.com>
@knoxsp
knoxsp marked this pull request as ready for review March 9, 2026 13:41
@knoxsp
knoxsp merged commit 3198d47 into improve_get_network_attributes Mar 9, 2026
6 checks passed
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