Skip to content

Commit 322a0d1

Browse files
authored
Merge pull request #199 from opsmill/dga-20250101-property
Add property flag to control if the GraphQL query should include properties
2 parents 71ad928 + 9c87b10 commit 322a0d1

File tree

4 files changed

+416
-50
lines changed

4 files changed

+416
-50
lines changed

changelog/191.changed.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Disable by default the inclusion of properties for Attribute and Relationships when querying nodes from Infrahub.
2+
The inclusion of properties can be enabled by using the parameter property in client.get|all|filters

infrahub_sdk/client.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ async def get(
331331
populate_store: bool = ...,
332332
fragment: bool = ...,
333333
prefetch_relationships: bool = ...,
334+
property: bool = ...,
334335
**kwargs: Any,
335336
) -> SchemaType | None: ...
336337

@@ -349,6 +350,7 @@ async def get(
349350
populate_store: bool = ...,
350351
fragment: bool = ...,
351352
prefetch_relationships: bool = ...,
353+
property: bool = ...,
352354
**kwargs: Any,
353355
) -> SchemaType: ...
354356

@@ -367,6 +369,7 @@ async def get(
367369
populate_store: bool = ...,
368370
fragment: bool = ...,
369371
prefetch_relationships: bool = ...,
372+
property: bool = ...,
370373
**kwargs: Any,
371374
) -> SchemaType: ...
372375

@@ -385,6 +388,7 @@ async def get(
385388
populate_store: bool = ...,
386389
fragment: bool = ...,
387390
prefetch_relationships: bool = ...,
391+
property: bool = ...,
388392
**kwargs: Any,
389393
) -> InfrahubNode | None: ...
390394

@@ -403,6 +407,7 @@ async def get(
403407
populate_store: bool = ...,
404408
fragment: bool = ...,
405409
prefetch_relationships: bool = ...,
410+
property: bool = ...,
406411
**kwargs: Any,
407412
) -> InfrahubNode: ...
408413

@@ -421,6 +426,7 @@ async def get(
421426
populate_store: bool = ...,
422427
fragment: bool = ...,
423428
prefetch_relationships: bool = ...,
429+
property: bool = ...,
424430
**kwargs: Any,
425431
) -> InfrahubNode: ...
426432

@@ -438,6 +444,7 @@ async def get(
438444
populate_store: bool = False,
439445
fragment: bool = False,
440446
prefetch_relationships: bool = False,
447+
property: bool = False,
441448
**kwargs: Any,
442449
) -> InfrahubNode | SchemaType | None:
443450
branch = branch or self.default_branch
@@ -470,6 +477,7 @@ async def get(
470477
exclude=exclude,
471478
fragment=fragment,
472479
prefetch_relationships=prefetch_relationships,
480+
property=property,
473481
**filters,
474482
)
475483

@@ -533,6 +541,7 @@ async def all(
533541
exclude: list[str] | None = ...,
534542
fragment: bool = ...,
535543
prefetch_relationships: bool = ...,
544+
property: bool = ...,
536545
) -> list[SchemaType]: ...
537546

538547
@overload
@@ -549,6 +558,7 @@ async def all(
549558
exclude: list[str] | None = ...,
550559
fragment: bool = ...,
551560
prefetch_relationships: bool = ...,
561+
property: bool = ...,
552562
) -> list[InfrahubNode]: ...
553563

554564
async def all(
@@ -564,6 +574,7 @@ async def all(
564574
exclude: list[str] | None = None,
565575
fragment: bool = False,
566576
prefetch_relationships: bool = False,
577+
property: bool = False,
567578
) -> list[InfrahubNode] | list[SchemaType]:
568579
"""Retrieve all nodes of a given kind
569580
@@ -595,6 +606,7 @@ async def all(
595606
exclude=exclude,
596607
fragment=fragment,
597608
prefetch_relationships=prefetch_relationships,
609+
property=property,
598610
)
599611

600612
@overload
@@ -612,6 +624,7 @@ async def filters(
612624
fragment: bool = ...,
613625
prefetch_relationships: bool = ...,
614626
partial_match: bool = ...,
627+
property: bool = ...,
615628
**kwargs: Any,
616629
) -> list[SchemaType]: ...
617630

@@ -630,6 +643,7 @@ async def filters(
630643
fragment: bool = ...,
631644
prefetch_relationships: bool = ...,
632645
partial_match: bool = ...,
646+
property: bool = ...,
633647
**kwargs: Any,
634648
) -> list[InfrahubNode]: ...
635649

@@ -647,6 +661,7 @@ async def filters(
647661
fragment: bool = False,
648662
prefetch_relationships: bool = False,
649663
partial_match: bool = False,
664+
property: bool = False,
650665
**kwargs: Any,
651666
) -> list[InfrahubNode] | list[SchemaType]:
652667
"""Retrieve nodes of a given kind based on provided filters.
@@ -696,6 +711,7 @@ async def filters(
696711
fragment=fragment,
697712
prefetch_relationships=prefetch_relationships,
698713
partial_match=partial_match,
714+
# property=property,
699715
)
700716
query = Query(query=query_data)
701717
response = await self.execute_graphql(
@@ -1549,6 +1565,7 @@ def all(
15491565
exclude: list[str] | None = ...,
15501566
fragment: bool = ...,
15511567
prefetch_relationships: bool = ...,
1568+
property: bool = ...,
15521569
) -> list[SchemaTypeSync]: ...
15531570

15541571
@overload
@@ -1565,6 +1582,7 @@ def all(
15651582
exclude: list[str] | None = ...,
15661583
fragment: bool = ...,
15671584
prefetch_relationships: bool = ...,
1585+
property: bool = ...,
15681586
) -> list[InfrahubNodeSync]: ...
15691587

15701588
def all(
@@ -1580,6 +1598,7 @@ def all(
15801598
exclude: list[str] | None = None,
15811599
fragment: bool = False,
15821600
prefetch_relationships: bool = False,
1601+
property: bool = False,
15831602
) -> list[InfrahubNodeSync] | list[SchemaTypeSync]:
15841603
"""Retrieve all nodes of a given kind
15851604
@@ -1611,6 +1630,7 @@ def all(
16111630
exclude=exclude,
16121631
fragment=fragment,
16131632
prefetch_relationships=prefetch_relationships,
1633+
property=property,
16141634
)
16151635

16161636
def _process_nodes_and_relationships(
@@ -1663,6 +1683,7 @@ def filters(
16631683
fragment: bool = ...,
16641684
prefetch_relationships: bool = ...,
16651685
partial_match: bool = ...,
1686+
property: bool = ...,
16661687
**kwargs: Any,
16671688
) -> list[SchemaTypeSync]: ...
16681689

@@ -1681,6 +1702,7 @@ def filters(
16811702
fragment: bool = ...,
16821703
prefetch_relationships: bool = ...,
16831704
partial_match: bool = ...,
1705+
property: bool = ...,
16841706
**kwargs: Any,
16851707
) -> list[InfrahubNodeSync]: ...
16861708

@@ -1698,6 +1720,7 @@ def filters(
16981720
fragment: bool = False,
16991721
prefetch_relationships: bool = False,
17001722
partial_match: bool = False,
1723+
property: bool = False,
17011724
**kwargs: Any,
17021725
) -> list[InfrahubNodeSync] | list[SchemaTypeSync]:
17031726
"""Retrieve nodes of a given kind based on provided filters.
@@ -1747,6 +1770,7 @@ def filters(
17471770
fragment=fragment,
17481771
prefetch_relationships=prefetch_relationships,
17491772
partial_match=partial_match,
1773+
property=property,
17501774
)
17511775
query = Query(query=query_data)
17521776
response = self.execute_graphql(
@@ -1799,6 +1823,7 @@ def get(
17991823
populate_store: bool = ...,
18001824
fragment: bool = ...,
18011825
prefetch_relationships: bool = ...,
1826+
property: bool = ...,
18021827
**kwargs: Any,
18031828
) -> SchemaTypeSync | None: ...
18041829

@@ -1817,6 +1842,7 @@ def get(
18171842
populate_store: bool = ...,
18181843
fragment: bool = ...,
18191844
prefetch_relationships: bool = ...,
1845+
property: bool = ...,
18201846
**kwargs: Any,
18211847
) -> SchemaTypeSync: ...
18221848

@@ -1835,6 +1861,7 @@ def get(
18351861
populate_store: bool = ...,
18361862
fragment: bool = ...,
18371863
prefetch_relationships: bool = ...,
1864+
property: bool = ...,
18381865
**kwargs: Any,
18391866
) -> SchemaTypeSync: ...
18401867

@@ -1853,6 +1880,7 @@ def get(
18531880
populate_store: bool = ...,
18541881
fragment: bool = ...,
18551882
prefetch_relationships: bool = ...,
1883+
property: bool = ...,
18561884
**kwargs: Any,
18571885
) -> InfrahubNodeSync | None: ...
18581886

@@ -1871,6 +1899,7 @@ def get(
18711899
populate_store: bool = ...,
18721900
fragment: bool = ...,
18731901
prefetch_relationships: bool = ...,
1902+
property: bool = ...,
18741903
**kwargs: Any,
18751904
) -> InfrahubNodeSync: ...
18761905

@@ -1889,6 +1918,7 @@ def get(
18891918
populate_store: bool = ...,
18901919
fragment: bool = ...,
18911920
prefetch_relationships: bool = ...,
1921+
property: bool = ...,
18921922
**kwargs: Any,
18931923
) -> InfrahubNodeSync: ...
18941924

@@ -1906,6 +1936,7 @@ def get(
19061936
populate_store: bool = False,
19071937
fragment: bool = False,
19081938
prefetch_relationships: bool = False,
1939+
property: bool = False,
19091940
**kwargs: Any,
19101941
) -> InfrahubNodeSync | SchemaTypeSync | None:
19111942
branch = branch or self.default_branch
@@ -1938,6 +1969,7 @@ def get(
19381969
exclude=exclude,
19391970
fragment=fragment,
19401971
prefetch_relationships=prefetch_relationships,
1972+
property=property,
19411973
**filters,
19421974
)
19431975

0 commit comments

Comments
 (0)