Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IFC-128 try to get a query working for neo4j 5.21.2 #3880

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
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
19 changes: 14 additions & 5 deletions backend/infrahub/core/query/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,16 +616,25 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None:
}
WITH n1 as n, r1 as rb
WHERE rb.status = "active"
OPTIONAL MATCH profile_path = (n)-[:IS_RELATED]->(profile_r:Relationship)<-[:IS_RELATED]-(profile:Node)-[:IS_PART_OF]->(:Root)
WHERE profile_r.name = "node__profile"
AND profile.namespace = "Profile"
AND all(r in relationships(profile_path) WHERE %(branch_filter)s and r.status = "active")
WITH n, rb, COLLECT {
OPTIONAL MATCH profile_path = (n)-[:IS_RELATED]->(profile_r:Relationship)<-[:IS_RELATED]-(profile:Node)-[:IS_PART_OF]->(:Root)
WHERE profile_r.name = "node__profile"
AND profile.namespace = "Profile"
AND all(r in relationships(profile_path) WHERE %(branch_filter)s and r.status = "active")
RETURN profile.uuid
} AS profile_uuids_with_nulls
WITH
n,
rb,
reduce(
non_null = [], uuid in profile_uuids_with_nulls | CASE WHEN uuid IS NOT NULL THEN non_null + [uuid] ELSE non_null END
) as profile_uuids
""" % {"branch_filter": branch_filter}

self.add_to_query(query)
self.params["ids"] = self.ids

self.return_labels = ["collect(profile.uuid) as profile_uuids", "n", "rb"]
self.return_labels = ["profile_uuids", "n", "rb"]

async def get_nodes(self, db: InfrahubDatabase, duplicate: bool = False) -> AsyncIterator[NodeToProcess]:
"""Return all the node objects as NodeToProcess."""
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ services:
retries: 3

database:
image: ${NEO4J_DOCKER_IMAGE:-neo4j:5.19.0-community}
image: ${NEO4J_DOCKER_IMAGE:-neo4j:5.22.0-enterprise}
restart: unless-stopped
environment:
- "NEO4J_AUTH=neo4j/admin"
Expand Down
109 changes: 55 additions & 54 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ optional = true

[tool.poetry.dependencies]
python = "^3.10, < 3.13"
neo4j = "~5.20"
neo4j-rust-ext = "^5.20.0.0"
neo4j = "~5.23"
neo4j-rust-ext = "^5.23.0.0"
infrahub-sdk = {path = "python_sdk", extras = ["ctl","tests"], develop=true}
pydantic = "2.7.2"
pydantic-settings = "~2.2"
Expand Down
2 changes: 1 addition & 1 deletion tasks/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DatabaseType(str, Enum):
MEMGRAPH_DOCKER_IMAGE = os.getenv(
"MEMGRAPH_DOCKER_IMAGE", "memgraph/memgraph-platform:2.14.0-memgraph2.14.0-lab2.11.1-mage1.14"
)
NEO4J_DOCKER_IMAGE = os.getenv("NEO4J_DOCKER_IMAGE", "neo4j:5.19.0-enterprise")
NEO4J_DOCKER_IMAGE = os.getenv("NEO4J_DOCKER_IMAGE", "neo4j:5.22.0-enterprise")
MESSAGE_QUEUE_DOCKER_IMAGE = os.getenv(
"MESSAGE_QUEUE_DOCKER_IMAGE", "rabbitmq:3.13.1-management" if not INFRAHUB_USE_NATS else "nats:2.10.14-alpine"
)
Expand Down
Loading