Query Jira Epics, Sprints & Cycle Time with Snowflake Cortex Analyst
Instead of hand-writing SQL joins every time a VP of Engineering or Product Manager asks about stalled tickets, sprint rollover, or epic delivery pace, you can deploy a native Snowflake SEMANTIC VIEW over the Jira tables synced by Snowflake CDC Connector for Jira.
Everything executes inside your own Snowflake account (SQL REST API v2 load + native Snowflake Cortex Analyst execution), with zero third-party AI middleware or external YAML storage.
Prerequisites Before Creating the Semantic View
- Run Your Initial Backfill: Verify that
"ISSUES_CURRENT","STATUS_DURATIONS", and"SPRINT_HISTORY"exist in your target Snowflake database and schema ("RAW_JIRA"."PUBLIC"by default). - Enable Optional Display Names (Recommended for Plain-English Queries): On the Projects & Fields tab inside Jira Administration, enable Include assignee & reporter display names in ISSUES_CURRENT and save settings. Without this opt-in setting,
issues.assignee_nameandissues.reporter_nameremainNULLso default tables only store pseudonymousaccountIdidentifiers. - Grant Semantic View Privileges (Once): Run the grant below in Snowsight if creating the semantic view with
JIRA_CDC_ROLEinstead ofSYSADMIN:GRANT CREATE SEMANTIC VIEW ON SCHEMA "RAW_JIRA"."PUBLIC" TO ROLE "JIRA_CDC_ROLE";
Complete CREATE OR REPLACE SEMANTIC VIEW Statement
The Sample Queries tab inside Jira Administration pre-fills this exact DDL with your configured database, schema, and target table names. Run it once in a Snowsight worksheet:
CREATE OR REPLACE SEMANTIC VIEW "RAW_JIRA"."PUBLIC"."JIRA_AGILE_ANALYST"
TABLES (
issues AS "RAW_JIRA"."PUBLIC"."ISSUES_CURRENT"
PRIMARY KEY ("ISSUE_ID")
WITH SYNONYMS ('jira tickets', 'jira issues', 'backlog')
COMMENT = 'Current Jira issue state with parent and epic hierarchy',
durations AS "RAW_JIRA"."PUBLIC"."STATUS_DURATIONS"
PRIMARY KEY ("DURATION_ID")
WITH SYNONYMS ('cycle time', 'workflow durations', 'time in status')
COMMENT = 'Time each Jira issue spent in each workflow status',
sprints AS "RAW_JIRA"."PUBLIC"."SPRINT_HISTORY"
PRIMARY KEY ("SPRINT_HISTORY_ID")
WITH SYNONYMS ('sprints', 'sprint assignments', 'sprint rollover')
COMMENT = 'Sprint scope, completions, and carry over history per issue'
)
RELATIONSHIPS (
duration_to_issue AS durations ("ISSUE_ID") REFERENCES issues,
sprint_to_issue AS sprints ("ISSUE_ID") REFERENCES issues
)
FACTS (
issues.story_points AS issues."STORY_POINTS"
COMMENT = 'Estimated story points for the issue',
durations.duration_hours AS ROUND(durations."DURATION_SECONDS" / 3600.0, 2)
COMMENT = 'Hours spent inside a workflow status'
)
DIMENSIONS (
issues.issue_key AS issues."ISSUE_KEY",
issues.project_key AS issues."PROJECT_KEY",
issues.issue_type AS issues."ISSUE_TYPE",
issues.status_name AS issues."STATUS_NAME",
issues.status_category AS issues."STATUS_CATEGORY",
issues.priority_name AS issues."PRIORITY_NAME",
issues.assignee_name AS issues."ASSIGNEE_DISPLAY_NAME",
issues.reporter_name AS issues."REPORTER_DISPLAY_NAME",
issues.parent_key AS issues."PARENT_KEY",
issues.epic_key AS issues."EPIC_KEY",
issues.created_at AS issues."CREATED_AT",
issues.resolved_at AS issues."RESOLVED_AT",
durations.workflow_status AS durations."STATUS_NAME",
durations.is_current_status AS durations."IS_CURRENT",
durations.entered_at AS durations."ENTERED_AT",
durations.exited_at AS durations."EXITED_AT",
sprints.sprint_name AS sprints."SPRINT_NAME",
sprints.sprint_state AS sprints."SPRINT_STATE",
sprints.is_active_in_sprint AS sprints."IS_ACTIVE_IN_SPRINT"
)
METRICS (
issues.issue_count AS COUNT(DISTINCT issues."ISSUE_ID")
COMMENT = 'Total count of unique Jira issues',
issues.total_story_points AS COALESCE(SUM(issues.story_points), 0)
COMMENT = 'Sum of story points across selected issues',
durations.avg_status_hours AS ROUND(AVG(durations.duration_hours), 2)
COMMENT = 'Average hours spent in a workflow status'
)
COMMENT = 'Jira agile delivery, hierarchy, cycle time, and sprint analytics semantic view for Snowflake Cortex Analyst';
Six Plain-English Questions Cortex Analyst Answers Out of the Box
Point Snowflake Cortex Analyst (or Snowflake Intelligence) at "RAW_JIRA"."PUBLIC"."JIRA_AGILE_ANALYST" and ask questions such as:
- Epic Progress: "Which epics (
epic_key) across each project still have open story points outsideDonestatus?" - Workflow Bottlenecks: "What is the average status hours spent in
In ProgressandIn Reviewby issue type over the past 90 days?" - Stalled Active Work: "List the 15 open tickets currently active (
is_current_status = TRUE) that have been in their current status longest, along with assignee and parent epic." - Sprint Rollover & Scope: "Compare distinct ticket count and total story points across active and closed sprints by project."
- Bug vs. Story Mix: "How many unique bugs vs. stories have been resolved per project by week?"
- Assignee Workload: "Show active open issue count and total story points grouped by
assignee_namefor projectENG."
Data Governance & Privacy Boundary
- Prompts and Results Never Leave Snowflake: Cortex Analyst evaluates questions exclusively inside your Snowflake account against your semantic view. Frontier Principles (
Petridisz & Company Kft.) operates zero external proxy servers and never sees Cortex Analyst prompts or answers. - No
ISSUE_KEYOrphan Joins: Relationships join strictly on"ISSUE_ID", so renaming or moving tickets between Jira projects preserves continuous epic, cycle time, and sprint history.
Related Documentation
- Step-by-Step Setup & Complete SQL Template: Setup & SQL Guide
- Manual Cycle Time & Bottleneck Queries: Jira Time in Status in Snowflake SQL
- Security & Direct Forge Architecture: Security & Egress Overview