Skip to content

Add SQLView profile for composable queries - #364

Merged
niquola merged 6 commits into
mainfrom
allow-sqlquery-references
Jun 7, 2026
Merged

Add SQLView profile for composable queries#364
niquola merged 6 commits into
mainfrom
allow-sqlquery-references

Conversation

@johngrimes

Copy link
Copy Markdown
Collaborator

This branch adds a SQLView profile so that views can be composed from other queries, alongside related refinements to the SQLQuery artifacts.

The main changes are:

  • A new SQLView profile on Library for composable queries, with dependency references to SQLView/SQLQuery constrained via targetProfile.
  • Grouping of SQL Query and SQL View under a single SQL menu in the IG.
  • Updated intro and notes pages for both SQLQuery and SQLView, plus a worked patient address view example.

Closes #329.

Initialise OpenSpec with the jg-spec-driven schema and add the
add-sqlview-profile change: proposal, specs, design, and tasks. The
change captures the resolution for inter-query dependencies - a new
SQLView Library profile (sql-view type, no parameters) and widening the
SQLQuery relatedArtifact rule to reference ViewDefinitions or SQLViews.
Update the add-sqlview-profile change to constrain
relatedArtifact.resource with only Canonical(ViewDefinition or SQLView)
on both profiles, rather than leaving the canonical unconstrained and
documented in prose. This makes the allowed dependency targets
machine-readable and validated whenever the canonical resolves, with the
^short retained as a fallback for unresolvable references. Notes the
logical-model nature of ViewDefinition as a build verification point.

Also soften the composition requirement so acyclicity is advised
(SHOULD) rather than mandated, with cycle handling left to
implementations, matching the issue #329 resolution.
Introduce an SQLView Library profile representing a reusable, named query
that other queries reference as a virtual table source, resolving issue
#329. SQLView fixes its type to LibraryTypesCodes#sql-view, prohibits
parameters, and carries SQL using the same attachment rules as SQLQuery.

Constrain relatedArtifact.resource on both SQLView and SQLQuery to
Canonical(ViewDefinition or SQLView) so the allowed dependency targets are
machine-readable and validated whenever the canonical resolves. Add the
sql-view code to LibraryTypesCodes, an SQLView example composed by an
SQLQuery, documentation describing query composition, and a SQL View menu
entry.
Move the completed add-sqlview-profile change to the archive and create the
sql-view capability spec in the main specs from the change's delta.
@niquola
niquola merged commit b703f5d into main Jun 7, 2026
1 check passed
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.

Allow SQLQuery to reference other SQLQuery results (inter-query dependencies)

2 participants