SQL on FHIR
2.1.0-pre - release International flag

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

: SQLQuery Run - JSON Representation

Active as of 2026-02-24

Raw json | Download

{
  "resourceType" : "OperationDefinition",
  "id" : "SQLQueryRun",
  "text" : {
    "status" : "generated",
    "div" : "<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>\n</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>\n</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>\n</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>\n</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>\n</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>\n</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>\n</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>\n</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>\n</div></td></tr></table></div>"
  },
  "url" : "http://sql-on-fhir.org/OperationDefinition/$sqlquery-run",
  "version" : "2.1.0-pre",
  "versionAlgorithmString" : "semver",
  "name" : "SQLQueryRun",
  "title" : "SQLQuery Run",
  "status" : "active",
  "kind" : "operation",
  "date" : "2026-02-24T21:00:17+00:00",
  "publisher" : "SQL on FHIR Working Group",
  "contact" : [
    {
      "name" : "SQL on FHIR Working Group",
      "telecom" : [
        {
          "system" : "url",
          "value" : "https://sql-on-fhir.org"
        }
      ]
    }
  ],
  "description" : "Execute a SQLQuery Library against ViewDefinition tables.",
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
          "code" : "001",
          "display" : "World"
        }
      ]
    }
  ],
  "code" : "sqlquery-run",
  "resource" : [
    "Library"
  ],
  "system" : true,
  "type" : true,
  "instance" : true,
  "parameter" : [
    {
      "name" : "_format",
      "use" : "in",
      "scope" : [
        "type",
        "instance"
      ],
      "min" : 1,
      "max" : "1",
      "documentation" : "Output format for the result (json, ndjson, csv, parquet).",
      "type" : "code",
      "binding" : {
        "strength" : "extensible",
        "valueSet" : "https://sql-on-fhir.org/ig/ValueSet/OutputFormatCodes"
      }
    },
    {
      "name" : "header",
      "use" : "in",
      "scope" : [
        "type",
        "instance"
      ],
      "min" : 0,
      "max" : "1",
      "documentation" : "Include CSV headers (default true). Applies only when csv output is requested.",
      "type" : "boolean"
    },
    {
      "name" : "queryReference",
      "use" : "in",
      "scope" : [
        "type"
      ],
      "min" : 0,
      "max" : "1",
      "documentation" : "Reference to a SQLQuery Library stored on the server.",
      "type" : "Reference"
    },
    {
      "extension" : [
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/operationdefinition-allowed-type",
          "valueUri" : "https://sql-on-fhir.org/ig/StructureDefinition/SQLQuery"
        }
      ],
      "name" : "queryResource",
      "use" : "in",
      "scope" : [
        "type"
      ],
      "min" : 0,
      "max" : "1",
      "documentation" : "Inline SQLQuery Library resource to execute.",
      "type" : "Resource"
    },
    {
      "name" : "parameter",
      "use" : "in",
      "scope" : [
        "type",
        "instance"
      ],
      "min" : 0,
      "max" : "*",
      "documentation" : "Query parameter values. Each parameter must match a declared parameter in the SQLQuery Library.",
      "part" : [
        {
          "name" : "name",
          "use" : "in",
          "min" : 1,
          "max" : "1",
          "documentation" : "Parameter name (must match Library.parameter.name).",
          "type" : "string"
        },
        {
          "name" : "value",
          "use" : "in",
          "min" : 1,
          "max" : "1",
          "documentation" : "Parameter value (use valueString, valueDate, valueInteger, etc. matching the declared type).",
          "type" : "DataType"
        }
      ]
    },
    {
      "name" : "source",
      "use" : "in",
      "scope" : [
        "type",
        "instance"
      ],
      "min" : 0,
      "max" : "1",
      "documentation" : "External data source containing the ViewDefinition tables.",
      "type" : "string"
    },
    {
      "name" : "return",
      "use" : "out",
      "min" : 1,
      "max" : "1",
      "documentation" : "Query results encoded in the requested output format.",
      "type" : "Binary"
    }
  ]
}