Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
---
# A bad edit to a workflow or to this filter file can silently skip jobs, so
# every filter below folds in *ci_config: any change to the CI plumbing runs the
# full pipeline.
ci_config: &ci_config
- ".github/workflows/ci.yml"
- ".github/workflows/**"
- ".github/file-filters.yml"

coverage_config: &coverage_config
- "codecov.yml"

github_workflows: &github_workflows
- ".github/workflows/*.yml"
- *ci_config

development_files: &development_files
- "development/**"
Expand Down Expand Up @@ -43,6 +46,8 @@ documentation_all:
- *development_files
- *doc_files
- *markdown_all
- *ci_config

documentation_generated_all:
- *infrahub_reference_generated
- *ci_config
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ jobs:
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
(needs.files-changed.outputs.python == 'true') || (needs.files-changed.outputs.documentation_generated == 'true')
(needs.files-changed.outputs.python == 'true' || needs.files-changed.outputs.documentation_generated == 'true')
needs: ["prepare-environment", "files-changed", "yaml-lint", "python-lint"]
runs-on: "ubuntu-22.04"
timeout-minutes: 5
Expand Down
1 change: 1 addition & 0 deletions changelog/+relationship-peer-count.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The queries generated by `all()`, `filters()`, `get()` and relationship `fetch()` no longer request `count` on cardinality-many relationships. The SDK never read that value, and Infrahub resolved it with one extra database query per returned node and per relationship, on top of preventing the peer reads of those nodes from being batched into a single query.
3 changes: 1 addition & 2 deletions infrahub_sdk/node/relationship.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,11 @@ def _generate_query_data(

Returns:
Dict: A dictionary representing the basic structure of a GraphQL query for multiple related nodes.
It includes count, edges, and node information (ID, display label, and typename), along with additional properties
It includes edges and node information (ID, display label, and typename), along with additional properties
and any peer_data provided.

"""
data: dict[str, Any] = {
"count": None,
"edges": {"node": {"id": None, "hfid": None, "display_label": None, "__typename": None}},
}

Expand Down
6 changes: 2 additions & 4 deletions tests/unit/sdk/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,6 @@ async def test_query_data_include_property(
},
},
"tags": {
"count": None,
"edges": {
"properties": {
"is_protected": None,
Expand Down Expand Up @@ -1324,7 +1323,6 @@ async def test_query_data_include(
},
},
"tags": {
"count": None,
"edges": {
"node": {
"id": None,
Expand Down Expand Up @@ -3062,7 +3060,7 @@ def test_relationship_manager_generate_query_data_with_include_metadata() -> Non
"""Test that RelationshipManagerBase._generate_query_data includes metadata when include_metadata=True."""
data = RelationshipManagerBase._generate_query_data(include_metadata=True)

assert "count" in data
assert "count" not in data
assert "edges" in data
assert "node" in data["edges"]
assert data["edges"]["node"]["id"] is None
Expand Down Expand Up @@ -3108,7 +3106,7 @@ def test_relationship_manager_generate_query_data_without_include_metadata() ->
assert "node_metadata" not in data["edges"]
assert "relationship_metadata" not in data["edges"]

assert "count" in data
assert "count" not in data
assert "edges" in data
assert "node" in data["edges"]

Expand Down
Loading