Skip to content

Commit 0522230

Browse files
committed
Upgrade to neo4j 5.26.5
1 parent 81d2a3b commit 0522230

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+301
-545
lines changed

backend/infrahub/cli/db.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,11 +489,10 @@ async def selected_export(
489489
ORDER BY %(id_func)s(n)
490490
SKIP toInteger($offset)
491491
LIMIT toInteger($limit)
492-
CALL {
492+
CALL (n) {
493493
// --------------
494494
// get all the nodes and edges linked to this node up to 2 steps away, excluding IS_PART_OF
495495
// --------------
496-
WITH n
497496
MATCH (n)-[r1]-(v1)-[r2]-(v2)
498497
WHERE type(r1) <> "IS_PART_OF"
499498
WITH collect([v1, v2]) AS vertex_pairs, collect([r1, r2]) AS edge_pairs

backend/infrahub/core/account.py

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
6969
query = """
7070
MATCH (account:%(generic_account_node)s)
7171
WHERE account.uuid = $account_id
72-
CALL {
73-
WITH account
72+
CALL (account) {
7473
MATCH (account)-[r:IS_PART_OF]-(root:Root)
7574
WHERE %(branch_filter)s
7675
RETURN account as account1, r as r1
@@ -80,8 +79,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
8079
WITH account, r1 as r
8180
WHERE r.status = "active"
8281
WITH account
83-
CALL {
84-
WITH account
82+
CALL (account) {
8583
MATCH (account)-[r1:IS_RELATED]->(:Relationship {name: "group_member"})<-[r2:IS_RELATED]-(account_group:%(account_group_node)s)
8684
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
8785
WITH account_group, r1, r2, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -92,8 +90,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
9290
}
9391
WITH account_group
9492
95-
CALL {
96-
WITH account_group
93+
CALL (account_group) {
9794
MATCH (account_group)-[r1:IS_RELATED]->(:Relationship {name: "role__accountgroups"})<-[r2:IS_RELATED]-(account_role:%(account_role_node)s)
9895
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
9996
WITH account_role, r1, r2, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -104,8 +101,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
104101
}
105102
WITH account_role
106103
107-
CALL {
108-
WITH account_role
104+
CALL (account_role) {
109105
MATCH (account_role)-[r1:IS_RELATED]->(:Relationship {name: "role__permissions"})<-[r2:IS_RELATED]-(global_permission:%(global_permission_node)s)
110106
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
111107
WITH global_permission, r1, r2, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -116,7 +112,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
116112
}
117113
WITH global_permission
118114
119-
CALL {
115+
CALL (global_permission) {
120116
WITH global_permission
121117
MATCH (global_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "action"})-[r2:HAS_VALUE]->(global_permission_action:AttributeValue)
122118
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
@@ -127,8 +123,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
127123
WITH global_permission, global_permission_action, is_active AS gpa_is_active
128124
WHERE gpa_is_active = TRUE
129125
130-
CALL {
131-
WITH global_permission
126+
CALL (global_permission) {
132127
MATCH (global_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "decision"})-[r2:HAS_VALUE]->(global_permission_decision:AttributeValue)
133128
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
134129
RETURN global_permission_decision, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -183,8 +178,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
183178
query = """
184179
MATCH (account:%(generic_account_node)s)
185180
WHERE account.uuid = $account_id
186-
CALL {
187-
WITH account
181+
CALL (account) {
188182
MATCH (account)-[r:IS_PART_OF]-(root:Root)
189183
WHERE %(branch_filter)s
190184
RETURN account as account1, r as r1
@@ -194,8 +188,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
194188
WITH account, r1 as r
195189
WHERE r.status = "active"
196190
WITH account
197-
CALL {
198-
WITH account
191+
CALL (account) {
199192
MATCH (account)-[r1:IS_RELATED]->(:Relationship {name: "group_member"})<-[r2:IS_RELATED]-(account_group:%(account_group_node)s)
200193
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
201194
WITH account_group, r1, r2, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -206,8 +199,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
206199
}
207200
WITH account_group
208201
209-
CALL {
210-
WITH account_group
202+
CALL (account_group) {
211203
MATCH (account_group)-[r1:IS_RELATED]->(:Relationship {name: "role__accountgroups"})<-[r2:IS_RELATED]-(account_role:%(account_role_node)s)
212204
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
213205
WITH account_role, r1, r2, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -218,8 +210,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
218210
}
219211
WITH account_role
220212
221-
CALL {
222-
WITH account_role
213+
CALL (account_role) {
223214
MATCH (account_role)-[r1:IS_RELATED]->(:Relationship {name: "role__permissions"})<-[r2:IS_RELATED]-(object_permission:%(object_permission_node)s)
224215
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
225216
WITH object_permission, r1, r2, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -230,8 +221,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
230221
}
231222
WITH object_permission
232223
233-
CALL {
234-
WITH object_permission
224+
CALL (object_permission) {
235225
MATCH (object_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "namespace"})-[r2:HAS_VALUE]->(object_permission_namespace:AttributeValue)
236226
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
237227
RETURN object_permission_namespace, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -240,8 +230,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
240230
}
241231
WITH object_permission, object_permission_namespace, is_active AS opn_is_active
242232
WHERE opn_is_active = TRUE
243-
CALL {
244-
WITH object_permission
233+
CALL (object_permission) {
245234
MATCH (object_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "name"})-[r2:HAS_VALUE]->(object_permission_name:AttributeValue)
246235
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
247236
RETURN object_permission_name, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -250,8 +239,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
250239
}
251240
WITH object_permission, object_permission_namespace, object_permission_name, is_active AS opn_is_active
252241
WHERE opn_is_active = TRUE
253-
CALL {
254-
WITH object_permission
242+
CALL (object_permission) {
255243
MATCH (object_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "action"})-[r2:HAS_VALUE]->(object_permission_action:AttributeValue)
256244
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
257245
RETURN object_permission_action, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -260,8 +248,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
260248
}
261249
WITH object_permission, object_permission_namespace, object_permission_name, object_permission_action, is_active AS opa_is_active
262250
WHERE opa_is_active = TRUE
263-
CALL {
264-
WITH object_permission
251+
CALL (object_permission) {
265252
MATCH (object_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "decision"})-[r2:HAS_VALUE]->(object_permission_decision:AttributeValue)
266253
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
267254
RETURN object_permission_decision, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -336,8 +323,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
336323
query = """
337324
MATCH (account_role:%(account_role_node)s)
338325
WHERE account_role.uuid = $role_id
339-
CALL {
340-
WITH account_role
326+
CALL (account_role) {
341327
MATCH (account_role)-[r:IS_PART_OF]-(root:Root)
342328
WHERE %(branch_filter)s
343329
RETURN account_role as account_role1, r as r1
@@ -348,8 +334,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
348334
WHERE r.status = "active"
349335
WITH account_role
350336
351-
CALL {
352-
WITH account_role
337+
CALL (account_role) {
353338
MATCH (account_role)-[r1:IS_RELATED]->(:Relationship {name: "role__permissions"})<-[r2:IS_RELATED]-(global_permission:%(global_permission_node)s)
354339
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
355340
WITH global_permission, r1, r2, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -360,8 +345,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
360345
}
361346
WITH global_permission
362347
363-
CALL {
364-
WITH global_permission
348+
CALL (global_permission) {
365349
MATCH (global_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "action"})-[r2:HAS_VALUE]->(global_permission_action:AttributeValue)
366350
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
367351
RETURN global_permission_action, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -371,8 +355,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
371355
WITH global_permission, global_permission_action, is_active AS gpa_is_active
372356
WHERE gpa_is_active = TRUE
373357
374-
CALL {
375-
WITH global_permission
358+
CALL (global_permission) {
376359
MATCH (global_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "decision"})-[r2:HAS_VALUE]->(global_permission_decision:AttributeValue)
377360
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
378361
RETURN global_permission_decision, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -425,8 +408,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
425408
query = """
426409
MATCH (account_role:%(account_role_node)s)
427410
WHERE account_role.uuid = $role_id
428-
CALL {
429-
WITH account_role
411+
CALL (account_role) {
430412
MATCH (account_role)-[r:IS_PART_OF]-(root:Root)
431413
WHERE %(branch_filter)s
432414
RETURN account_role as account_role1, r as r1
@@ -437,8 +419,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
437419
WHERE r.status = "active"
438420
WITH account_role
439421
440-
CALL {
441-
WITH account_role
422+
CALL (account_role) {
442423
MATCH (account_role)-[r1:IS_RELATED]->(:Relationship {name: "role__permissions"})<-[r2:IS_RELATED]-(object_permission:%(object_permission_node)s)
443424
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
444425
WITH object_permission, r1, r2, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -449,8 +430,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
449430
}
450431
WITH object_permission
451432
452-
CALL {
453-
WITH object_permission
433+
CALL (object_permission) {
454434
MATCH (object_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "namespace"})-[r2:HAS_VALUE]->(object_permission_namespace:AttributeValue)
455435
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
456436
RETURN object_permission_namespace, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -459,8 +439,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
459439
}
460440
WITH object_permission, object_permission_namespace, is_active AS opn_is_active
461441
WHERE opn_is_active = TRUE
462-
CALL {
463-
WITH object_permission
442+
CALL (object_permission) {
464443
MATCH (object_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "name"})-[r2:HAS_VALUE]->(object_permission_name:AttributeValue)
465444
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
466445
RETURN object_permission_name, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -469,8 +448,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
469448
}
470449
WITH object_permission, object_permission_namespace, object_permission_name, is_active AS opn_is_active
471450
WHERE opn_is_active = TRUE
472-
CALL {
473-
WITH object_permission
451+
CALL (object_permission) {
474452
MATCH (object_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "action"})-[r2:HAS_VALUE]->(object_permission_action:AttributeValue)
475453
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
476454
RETURN object_permission_action, (r1.status = "active" AND r2.status = "active") AS is_active
@@ -479,8 +457,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
479457
}
480458
WITH object_permission, object_permission_namespace, object_permission_name, object_permission_action, is_active AS opa_is_active
481459
WHERE opa_is_active = TRUE
482-
CALL {
483-
WITH object_permission
460+
CALL (object_permission) {
484461
MATCH (object_permission)-[r1:HAS_ATTRIBUTE]->(:Attribute {name: "decision"})-[r2:HAS_VALUE]->(object_permission_decision:AttributeValue)
485462
WHERE all(r IN [r1, r2] WHERE (%(branch_filter)s))
486463
RETURN object_permission_decision, (r1.status = "active" AND r2.status = "active") AS is_active

backend/infrahub/core/diff/query/all_conflicts.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,18 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
3737
($diff_id IS NOT NULL AND root.uuid = $diff_id)
3838
OR ($tracking_id IS NOT NULL AND root.tracking_id = $tracking_id AND root.diff_branch = $diff_branch_name)
3939
)
40-
CALL {
41-
WITH root
40+
CALL (root) {
4241
MATCH (root)-[:DIFF_HAS_NODE]->(node:DiffNode)-[:DIFF_HAS_CONFLICT]->(node_conflict:DiffConflict)
4342
RETURN node.path_identifier AS path_identifier, node_conflict AS conflict
4443
UNION
45-
WITH root
4644
MATCH (root)-[:DIFF_HAS_NODE]->(node:DiffNode)-[:DIFF_HAS_ATTRIBUTE]->(:DiffAttribute)
4745
-[:DIFF_HAS_PROPERTY]->(property:DiffProperty)-[:DIFF_HAS_CONFLICT]->(attr_property_conflict:DiffConflict)
4846
RETURN property.path_identifier AS path_identifier, attr_property_conflict AS conflict
4947
UNION
50-
WITH root
5148
MATCH (root)-[:DIFF_HAS_NODE]->(node:DiffNode)-[:DIFF_HAS_RELATIONSHIP]->(:DiffRelationship)
5249
-[:DIFF_HAS_ELEMENT]->(element:DiffRelationshipElement)-[:DIFF_HAS_CONFLICT]->(rel_element_conflict:DiffConflict)
5350
RETURN element.path_identifier AS path_identifier, rel_element_conflict AS conflict
5451
UNION
55-
WITH root
5652
MATCH (root)-[:DIFF_HAS_NODE]->(node:DiffNode)-[:DIFF_HAS_RELATIONSHIP]->(:DiffRelationship)
5753
-[:DIFF_HAS_ELEMENT]->(:DiffRelationshipElement)-[:DIFF_HAS_PROPERTY]->(property:DiffProperty)
5854
-[:DIFF_HAS_CONFLICT]->(rel_property_conflict:DiffConflict)

backend/infrahub/core/diff/query/artifact.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
4040
// -----------------------
4141
MATCH (source_artifact:%(artifact_kind)s)-[r:IS_PART_OF]->(:Root)
4242
WHERE r.branch IN [$source_branch_name, $target_branch_name]
43-
CALL {
44-
WITH source_artifact
43+
CALL (source_artifact) {
4544
MATCH (source_artifact)-[r:IS_PART_OF]->(:Root)
4645
WHERE %(source_branch_filter)s
4746
RETURN r AS root_rel
@@ -50,13 +49,11 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
5049
}
5150
WITH source_artifact, root_rel
5251
WHERE root_rel.status = "active"
53-
CALL {
54-
WITH source_artifact
52+
CALL (source_artifact) {
5553
// -----------------------
5654
// get the artifact's target node
5755
// -----------------------
58-
CALL {
59-
WITH source_artifact
56+
CALL (source_artifact) {
6057
OPTIONAL MATCH (source_artifact)-[rrel1:IS_RELATED]-(rel_node:Relationship)-[rrel2:IS_RELATED]-(target_node:Node)
6158
WHERE rel_node.name = $target_rel_identifier
6259
AND all(r IN [rrel1, rrel2] WHERE ( %(source_branch_filter)s ))
@@ -70,8 +67,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
7067
// -----------------------
7168
// get the artifact's definition node
7269
// -----------------------
73-
CALL {
74-
WITH source_artifact
70+
CALL (source_artifact) {
7571
OPTIONAL MATCH (source_artifact)-[rrel1:IS_RELATED]-(rel_node:Relationship)-[rrel2:IS_RELATED]-(definition_node:Node)
7672
WHERE rel_node.name = $definition_rel_identifier
7773
AND all(r IN [rrel1, rrel2] WHERE ( %(source_branch_filter)s ))
@@ -85,8 +81,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
8581
// -----------------------
8682
// get the artifact's checksum
8783
// -----------------------
88-
CALL {
89-
WITH source_artifact
84+
CALL (source_artifact) {
9085
OPTIONAL MATCH (source_artifact)-[attr_rel:HAS_ATTRIBUTE]->(attr:Attribute)-[value_rel:HAS_VALUE]->(attr_val:AttributeValue)
9186
WHERE attr.name = "checksum"
9287
AND all(r IN [attr_rel, value_rel] WHERE ( %(source_branch_filter)s ))
@@ -100,8 +95,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
10095
// -----------------------
10196
// get the artifact's storage_id
10297
// -----------------------
103-
CALL {
104-
WITH source_artifact
98+
CALL (source_artifact) {
10599
OPTIONAL MATCH (source_artifact)-[attr_rel:HAS_ATTRIBUTE]->(attr:Attribute)-[value_rel:HAS_VALUE]->(attr_val:AttributeValue)
106100
WHERE attr.name = "storage_id"
107101
AND all(r IN [attr_rel, value_rel] WHERE ( %(source_branch_filter)s ))
@@ -137,13 +131,11 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
137131
ELSE NULL
138132
END AS source_storage_id
139133
}
140-
CALL {
134+
CALL (target_node, definition_node){
141135
// -----------------------
142136
// get the corresponding artifact on the target branch, if it exists
143137
// -----------------------
144-
WITH target_node, definition_node
145-
CALL {
146-
WITH target_node, definition_node
138+
CALL (target_node, definition_node) {
147139
OPTIONAL MATCH path = (target_node)-[trel1:IS_RELATED]-(trel_node:Relationship)-[trel2:IS_RELATED]-
148140
(target_artifact:%(artifact_kind)s)-[drel1:IS_RELATED]-(drel_node:Relationship)-[drel2:IS_RELATED]-(definition_node)
149141
WHERE trel_node.name = $target_rel_identifier
@@ -165,8 +157,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
165157
// -----------------------
166158
// get the artifact's checksum on target branch
167159
// -----------------------
168-
CALL {
169-
WITH target_artifact
160+
CALL (target_artifact) {
170161
OPTIONAL MATCH (target_artifact)-[attr_rel:HAS_ATTRIBUTE]->(attr:Attribute)-[value_rel:HAS_VALUE]->(attr_val:AttributeValue)
171162
WHERE attr.name = "checksum"
172163
AND attr_rel.branch = $target_branch_name
@@ -178,8 +169,7 @@ async def query_init(self, db: InfrahubDatabase, **kwargs: Any) -> None: # noqa
178169
// -----------------------
179170
// get the artifact's storage_id on target branch
180171
// -----------------------
181-
CALL {
182-
WITH target_artifact
172+
CALL (target_artifact) {
183173
OPTIONAL MATCH (target_artifact)-[attr_rel:HAS_ATTRIBUTE]->(attr:Attribute)-[value_rel:HAS_VALUE]->(attr_val:AttributeValue)
184174
WHERE attr.name = "storage_id"
185175
AND attr_rel.branch = $target_branch_name

0 commit comments

Comments
 (0)