@@ -54,7 +54,6 @@ async def list_jira_issues(
54
54
search_text : Optional [str ] = None
55
55
) -> Dict [str , Any ]:
56
56
"""
57
- List JIRA issues from Snowflake with optional filtering.
58
57
59
58
Args:
60
59
project: Filter by project key (e.g., 'SMQE', 'OSIM')
@@ -332,13 +331,15 @@ async def list_jira_components(
332
331
project : Optional [str ] = None ,
333
332
archived : Optional [str ] = None ,
334
333
deleted : Optional [str ] = None ,
334
+ issue : Optional [str ] = None ,
335
335
limit : int = 50 ,
336
336
search_text : Optional [str ] = None
337
337
) -> Dict [str , Any ]:
338
338
"""
339
339
List JIRA components from Snowflake with optional filtering.
340
340
341
341
Args:
342
+ issue: Filter by issue ID (e.g., 'SMQE-1280')
342
343
project: Filter by project ID (e.g., '12325621')
343
344
archived: Filter by archived status ('Y' or 'N')
344
345
deleted: Filter by deleted status ('Y' or 'N')
@@ -357,17 +358,20 @@ async def list_jira_components(
357
358
# Build SQL query with filters
358
359
sql_conditions = []
359
360
361
+ if issue :
362
+ sql_conditions .append (f"i.ISSUE_KEY = '{ sanitize_sql_value (issue )} '" )
363
+
360
364
if project :
361
- sql_conditions .append (f"PROJECT = '{ sanitize_sql_value (project )} '" )
365
+ sql_conditions .append (f"c. PROJECT = '{ sanitize_sql_value (project )} '" )
362
366
363
367
if archived :
364
- sql_conditions .append (f"ARCHIVED = '{ sanitize_sql_value (archived .upper ())} '" )
368
+ sql_conditions .append (f"c. ARCHIVED = '{ sanitize_sql_value (archived .upper ())} '" )
365
369
366
370
if deleted :
367
- sql_conditions .append (f"DELETED = '{ sanitize_sql_value (deleted .upper ())} '" )
371
+ sql_conditions .append (f"c. DELETED = '{ sanitize_sql_value (deleted .upper ())} '" )
368
372
369
373
if search_text :
370
- search_condition = f"(LOWER(CNAME) LIKE '%{ sanitize_sql_value (search_text .lower ())} %' OR LOWER(DESCRIPTION) LIKE '%{ sanitize_sql_value (search_text .lower ())} %')"
374
+ search_condition = f"(LOWER(c. CNAME) LIKE '%{ sanitize_sql_value (search_text .lower ())} %' OR LOWER(c. DESCRIPTION) LIKE '%{ sanitize_sql_value (search_text .lower ())} %')"
371
375
sql_conditions .append (search_condition )
372
376
373
377
where_clause = ""
@@ -376,12 +380,17 @@ async def list_jira_components(
376
380
377
381
sql = f"""
378
382
SELECT
379
- ID, PROJECT, CNAME, DESCRIPTION, URL, LEAD,
380
- ASSIGNEETYPE, ARCHIVED, DELETED, _FIVETRAN_SYNCED
381
- FROM JIRA_COMPONENT_RHAI
382
- { where_clause }
383
- ORDER BY CNAME ASC
384
- LIMIT { limit }
383
+ c.ID, c.PROJECT, c.CNAME as COMPONENT_NAME, c.DESCRIPTION, c.URL, c.LEAD,
384
+ c.ASSIGNEETYPE, c.ARCHIVED, c.DELETED, c._FIVETRAN_SYNCED
385
+ FROM JIRA_DB.RHAI_MARTS.JIRA_ISSUE_NON_PII i
386
+ JOIN JIRA_DB.RHAI_MARTS.JIRA_NODEASSOCIATION_RHAI na
387
+ ON i.ID = na.SOURCE_NODE_ID
388
+ AND na.ASSOCIATION_TYPE = 'IssueComponent'
389
+ JOIN JIRA_DB.RHAI_MARTS.JIRA_COMPONENT_RHAI c
390
+ ON na.SINK_NODE_ID = c.ID
391
+ { where_clause }
392
+ ORDER BY c.CNAME ASC
393
+ LIMIT { limit }
385
394
"""
386
395
387
396
rows = await execute_snowflake_query (sql , snowflake_token )
@@ -390,7 +399,7 @@ async def list_jira_components(
390
399
391
400
# Expected column order based on SELECT statement
392
401
columns = [
393
- "ID" , "PROJECT" , "CNAME " , "DESCRIPTION" , "URL" , "LEAD" ,
402
+ "ID" , "PROJECT" , "COMPONENT_NAME " , "DESCRIPTION" , "URL" , "LEAD" ,
394
403
"ASSIGNEETYPE" , "ARCHIVED" , "DELETED" , "_FIVETRAN_SYNCED"
395
404
]
396
405
@@ -401,7 +410,7 @@ async def list_jira_components(
401
410
component = {
402
411
"id" : row_dict .get ("ID" ),
403
412
"project" : row_dict .get ("PROJECT" ),
404
- "name" : row_dict .get ("CNAME " ),
413
+ "name" : row_dict .get ("COMPONENT_NAME " ),
405
414
"description" : row_dict .get ("DESCRIPTION" ) or "" ,
406
415
"url" : row_dict .get ("URL" ),
407
416
"lead" : row_dict .get ("LEAD" ),
@@ -418,6 +427,7 @@ async def list_jira_components(
418
427
"total_returned" : len (components ),
419
428
"filters_applied" : {
420
429
"project" : project ,
430
+ "issue" : issue ,
421
431
"archived" : archived ,
422
432
"deleted" : deleted ,
423
433
"search_text" : search_text ,
0 commit comments