Skip to content

Commit 2b7ad37

Browse files
authored
Merge pull request #606 from atlanhq/APP-5774
APP-5774 : Extend tagged with value search with option for specific source tag
2 parents d39f2cc + 073bf53 commit 2b7ad37

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

pyatlan/model/fluent_search.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ def tagged(
151151

152152
@staticmethod
153153
def tagged_with_value(
154-
atlan_tag_name: str, value: str, directly: bool = False
154+
atlan_tag_name: str,
155+
value: str,
156+
directly: bool = False,
157+
source_tag_qualified_name: Optional[str] = None,
155158
) -> Query:
156159
"""
157160
Returns a query that will match assets that have a
@@ -161,7 +164,8 @@ def tagged_with_value(
161164
:param value: tag should have to match the query
162165
:param directly: when `True`, the asset must have the tag and
163166
value directly assigned (otherwise even propagated tags with the value will suffice)
164-
167+
:param source_tag_qualified_name: (optional) qualified name of
168+
the source tag to match (when there are multiple)
165169
:raises: AtlanError on any error communicating
166170
with the API to refresh the Atlan tag cache
167171
:returns: a query that will only match assets that have
@@ -182,17 +186,18 @@ def tagged_with_value(
182186
.execute(client=client)
183187
)
184188
]
185-
if len(synced_tags) > 1:
189+
if len(synced_tags) > 1 and source_tag_qualified_name is None:
186190
synced_tag_qn = synced_tags[0].qualified_name or ""
187191
LOGGER.warning(
188-
(
189-
"Multiple mapped source-synced tags found for tag %s -- using only the first: %s",
190-
),
192+
"Multiple mapped source-synced tags found for tag %s -- using only the first: %s. "
193+
"You can specify the `source_tag_qualified_name` so we can match to the specific one.",
191194
atlan_tag_name,
192195
synced_tag_qn,
193196
)
194197
elif synced_tags:
195-
synced_tag_qn = synced_tags[0].qualified_name or ""
198+
synced_tag_qn = (
199+
source_tag_qualified_name or synced_tags[0].qualified_name or ""
200+
)
196201
else:
197202
synced_tag_qn = "NON_EXISTENT"
198203

0 commit comments

Comments
 (0)