@@ -381,13 +381,15 @@ def __init__(
381
381
_page_size : Optional [int ] = None ,
382
382
_includes_on_results : Optional [List [str ]] = None ,
383
383
_includes_on_relations : Optional [List [str ]] = None ,
384
+ _include_relationship_attributes : Optional [bool ] = False ,
384
385
):
385
386
super ().__init__ (wheres , where_nots , where_somes , _min_somes )
386
387
self .sorts = sorts
387
388
self .aggregations = aggregations
388
389
self ._page_size = _page_size
389
390
self ._includes_on_results = _includes_on_results
390
391
self ._includes_on_relations = _includes_on_relations
392
+ self ._include_relationship_attributes = _include_relationship_attributes
391
393
392
394
def _clone (self ) -> "FluentSearch" :
393
395
"""
@@ -468,6 +470,22 @@ def include_on_relations(self, field: Union[str, AtlanField]) -> "FluentSearch":
468
470
clone ._includes_on_relations .append (field )
469
471
return clone
470
472
473
+ def include_relationship_attributes (self , include : bool ) -> "FluentSearch" :
474
+ """
475
+ Add an attribute to include relationship attributes on each relationship in the results.
476
+
477
+ :param include: include relationship attributes on each relationship in the results
478
+ :returns: the fluent search with this parameter added
479
+ """
480
+ clone = self ._clone ()
481
+ # When enabling `include_relationship_attributes`
482
+ # it's mandatory to include the "name" field
483
+ # to ensure relationship names are included in the response.
484
+ # Omitting "name" will result in a 500 error from the metastore.
485
+ clone = self .include_on_relations ("name" )
486
+ clone ._include_relationship_attributes = include
487
+ return clone
488
+
471
489
def _dsl (self ) -> DSL :
472
490
"""
473
491
Translate the Atlan fluent search into an Atlan search DSL.
@@ -495,6 +513,10 @@ def to_request(self) -> IndexSearchRequest:
495
513
request .attributes = self ._includes_on_results
496
514
if self ._includes_on_relations :
497
515
request .relation_attributes = self ._includes_on_relations
516
+ if self ._include_relationship_attributes :
517
+ request .include_relationship_attributes = (
518
+ self ._include_relationship_attributes
519
+ )
498
520
return request
499
521
500
522
def count (self , client : AtlanClient ) -> int :
0 commit comments