SQL on FHIR
2.1.0-pre - release
SQL on FHIR, published by SQL on FHIR Working Group. This guide is not an authorized publication; it is the continuous build for version 2.1.0-pre built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/FHIR/sql-on-fhir-v2/ and changes regularly. See the Directory of published versions
| Active as of 2026-02-24 |
<OperationDefinition xmlns="http://hl7.org/fhir">
<id value="SQLQueryRun"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: OperationDefinition SQLQueryRun</b></p><a name="SQLQueryRun"> </a><a name="hcSQLQueryRun"> </a><p>URL: [base]/$sqlquery-run</p><p>URL: [base]/Library/$sqlquery-run</p><p>URL: [base]/Library/[id]/$sqlquery-run</p><h3>Parameters</h3><table class="grid"><tr><td><b>Use</b></td><td><b>Name</b></td><td><b>Scope</b></td><td><b>Cardinality</b></td><td><b>Type</b></td><td><b>Binding</b></td><td><b>Documentation</b></td></tr><tr><td>IN</td><td>_format</td><td>type, instance</td><td>1..1</td><td><a href="http://hl7.org/fhir/R5/datatypes.html#code">code</a></td><td><a href="ValueSet-OutputFormatCodes.html">Output Format Codes</a> (Extensible)</td><td><div><p>Output format for the result (json, ndjson, csv, parquet).</p>
</div></td></tr><tr><td>IN</td><td>header</td><td>type, instance</td><td>0..1</td><td><a href="http://hl7.org/fhir/R5/datatypes.html#boolean">boolean</a></td><td/><td><div><p>Include CSV headers (default true). Applies only when csv output is requested.</p>
</div></td></tr><tr><td>IN</td><td>queryReference</td><td>type</td><td>0..1</td><td><a href="http://hl7.org/fhir/R5/references.html#Reference">Reference</a></td><td/><td><div><p>Reference to a SQLQuery Library stored on the server.</p>
</div></td></tr><tr><td>IN</td><td>queryResource</td><td>type</td><td>0..1</td><td><a href="StructureDefinition-SQLQuery.html">https://sql-on-fhir.org/ig/StructureDefinition/SQLQuery</a></td><td/><td><div><p>Inline SQLQuery Library resource to execute.</p>
</div></td></tr><tr><td>IN</td><td>parameter</td><td>type, instance</td><td>0..*</td><td/><td/><td><div><p>Query parameter values. Each parameter must match a declared parameter in the SQLQuery Library.</p>
</div></td></tr><tr><td>IN</td><td>parameter.name</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R5/datatypes.html#string">string</a></td><td/><td><div><p>Parameter name (must match Library.parameter.name).</p>
</div></td></tr><tr><td>IN</td><td>parameter.value</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R5/types.html#DataType">DataType</a></td><td/><td><div><p>Parameter value (use valueString, valueDate, valueInteger, etc. matching the declared type).</p>
</div></td></tr><tr><td>IN</td><td>source</td><td>type, instance</td><td>0..1</td><td><a href="http://hl7.org/fhir/R5/datatypes.html#string">string</a></td><td/><td><div><p>External data source containing the ViewDefinition tables.</p>
</div></td></tr><tr><td>OUT</td><td>return</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R5/binary.html">Binary</a></td><td/><td><div><p>Query results encoded in the requested output format.</p>
</div></td></tr></table></div>
</text>
<url value="http://sql-on-fhir.org/OperationDefinition/$sqlquery-run"/>
<version value="2.1.0-pre"/>
<versionAlgorithmString value="semver"/>
<name value="SQLQueryRun"/>
<title value="SQLQuery Run"/>
<status value="active"/>
<kind value="operation"/>
<date value="2026-02-24T21:00:17+00:00"/>
<publisher value="SQL on FHIR Working Group"/>
<contact>
<name value="SQL on FHIR Working Group"/>
<telecom>
<system value="url"/>
<value value="https://sql-on-fhir.org"/>
</telecom>
</contact>
<description
value="Execute a SQLQuery Library against ViewDefinition tables."/>
<jurisdiction>
<coding>
<system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
<code value="001"/>
<display value="World"/>
</coding>
</jurisdiction>
<code value="sqlquery-run"/>
<resource value="Library"/>
<system value="true"/>
<type value="true"/>
<instance value="true"/>
<parameter>
<name value="_format"/>
<use value="in"/>
<scope value="type"/>
<scope value="instance"/>
<min value="1"/>
<max value="1"/>
<documentation
value="Output format for the result (json, ndjson, csv, parquet)."/>
<type value="code"/>
<binding>
<strength value="extensible"/>
<valueSet
value="https://sql-on-fhir.org/ig/ValueSet/OutputFormatCodes"/>
</binding>
</parameter>
<parameter>
<name value="header"/>
<use value="in"/>
<scope value="type"/>
<scope value="instance"/>
<min value="0"/>
<max value="1"/>
<documentation
value="Include CSV headers (default true). Applies only when csv output is requested."/>
<type value="boolean"/>
</parameter>
<parameter>
<name value="queryReference"/>
<use value="in"/>
<scope value="type"/>
<min value="0"/>
<max value="1"/>
<documentation
value="Reference to a SQLQuery Library stored on the server."/>
<type value="Reference"/>
</parameter>
<parameter>
<extension
url="http://hl7.org/fhir/StructureDefinition/operationdefinition-allowed-type">
<valueUri
value="https://sql-on-fhir.org/ig/StructureDefinition/SQLQuery"/>
</extension>
<name value="queryResource"/>
<use value="in"/>
<scope value="type"/>
<min value="0"/>
<max value="1"/>
<documentation value="Inline SQLQuery Library resource to execute."/>
<type value="Resource"/>
</parameter>
<parameter>
<name value="parameter"/>
<use value="in"/>
<scope value="type"/>
<scope value="instance"/>
<min value="0"/>
<max value="*"/>
<documentation
value="Query parameter values. Each parameter must match a declared parameter in the SQLQuery Library."/>
<part>
<name value="name"/>
<use value="in"/>
<min value="1"/>
<max value="1"/>
<documentation
value="Parameter name (must match Library.parameter.name)."/>
<type value="string"/>
</part>
<part>
<name value="value"/>
<use value="in"/>
<min value="1"/>
<max value="1"/>
<documentation
value="Parameter value (use valueString, valueDate, valueInteger, etc. matching the declared type)."/>
<type value="DataType"/>
</part>
</parameter>
<parameter>
<name value="source"/>
<use value="in"/>
<scope value="type"/>
<scope value="instance"/>
<min value="0"/>
<max value="1"/>
<documentation
value="External data source containing the ViewDefinition tables."/>
<type value="string"/>
</parameter>
<parameter>
<name value="return"/>
<use value="out"/>
<min value="1"/>
<max value="1"/>
<documentation
value="Query results encoded in the requested output format."/>
<type value="Binary"/>
</parameter>
</OperationDefinition>