@@ -151,7 +151,10 @@ def tagged(
151
151
152
152
@staticmethod
153
153
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 ,
155
158
) -> Query :
156
159
"""
157
160
Returns a query that will match assets that have a
@@ -161,7 +164,8 @@ def tagged_with_value(
161
164
:param value: tag should have to match the query
162
165
:param directly: when `True`, the asset must have the tag and
163
166
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)
165
169
:raises: AtlanError on any error communicating
166
170
with the API to refresh the Atlan tag cache
167
171
:returns: a query that will only match assets that have
@@ -182,17 +186,18 @@ def tagged_with_value(
182
186
.execute (client = client )
183
187
)
184
188
]
185
- if len (synced_tags ) > 1 :
189
+ if len (synced_tags ) > 1 and source_tag_qualified_name is None :
186
190
synced_tag_qn = synced_tags [0 ].qualified_name or ""
187
191
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." ,
191
194
atlan_tag_name ,
192
195
synced_tag_qn ,
193
196
)
194
197
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
+ )
196
201
else :
197
202
synced_tag_qn = "NON_EXISTENT"
198
203
0 commit comments