Skip to content

dataset: shared SQL fragments - #180

Merged
trick77 merged 1 commit into
masterfrom
dataset-sql-fragments
Nov 19, 2026
Merged

trick77 merged 1 commit into
masterfrom
dataset-sql-fragments

Conversation

@trick77

@trick77 trick77 commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

The non_human_identities CTE, the touch JSON aggregate and the reviewer-touch event list were copied between prs.sql and open_prs.sql. They now live once in sql/fragments/, written at package init into /{{name}}/ placeholders of every embedded sql/*.sql. Fragments neither nest nor hold -- comments; a test checks that, no placeholder left over and no fragment unused.

Expanded queries match the old files modulo whitespace. Not unified, because they differ: the ready_at expressions (open_prs filters to before T and tests draft as NOT = 'true', prs as = 'false') and the touch filters (opener and ready in SQL for prs, in Go for open PRs). lead_times.sql's declared CTE carries the account kind, so it is no copy.

prs.sql and open_prs.sql each carried the non_human_identities CTE, the
touch JSON aggregate and the reviewer-touch event list. They now live once
in sql/fragments/, written at package init into /*{{name}}*/ placeholders
of every embedded sql/*.sql. Fragments neither nest nor hold -- comments;
a test checks that, no placeholder left over and no fragment unused.

Expanded queries match the old files modulo whitespace. The ready_at
expressions and the touch filters differ between the two files and stay
as they are; lead_times.sql's declared CTE carries the account kind and is
no copy.
@trick77
trick77 force-pushed the dataset-sql-fragments branch from 8a64519 to 88e3512 Compare November 19, 2026 08:48
@trick77
trick77 merged commit b90fc19 into master Nov 19, 2026
1 check passed
@trick77
trick77 deleted the dataset-sql-fragments branch November 19, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant