SQL on FHIR, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 3.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/sql-on-fhir/ and changes regularly. See the Directory of published versions
| Page standards status: Trial-use | Maturity Level: 2 |
{
"resourceType" : "OperationDefinition",
"id" : "SQLExport",
"language" : "en",
"text" : {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: OperationDefinition SQLExport</b></p><a name=\"SQLExport\"> </a><a name=\"hcSQLExport\"> </a><p>URL: [base]/$sql-export</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>subject</td><td/><td>1..*</td><td/><td/><td><div><p>One or more artifacts to export, in any mixture of ViewDefinitions, SQLQuery Libraries and SQLView Libraries. Each repetition names a single subject and produces exactly one output entry in the manifest. A request supplying no subject is rejected with 400 Bad Request, as is a request in which two repetitions would produce the same output name.</p>\n</div></td></tr><tr><td>IN</td><td>subject.name</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#string\">string</a></td><td/><td><div><p>Name for this subject's output entry in the manifest. Where it is omitted the server uses the subject's own name element, and where the subject declares none, a server-generated identifier. Output names are unique across the job.</p>\n</div></td></tr><tr><td>IN</td><td>subject.subjectCanonical</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#canonical\">canonical</a> (<a href=\"StructureDefinition-ViewDefinition.html\" title=\"http://hl7.org/fhir/StructureDefinition/ViewDefinition\">View Definition</a>, <a href=\"StructureDefinition-SQLQuery.html\" title=\"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLQuery\">SQL Query Library</a>, <a href=\"StructureDefinition-SQLView.html\" title=\"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLView\">SQL View Library</a>)</td><td/><td><div><p>Canonical URL of the ViewDefinition, SQLQuery Library or SQLView Library to export, optionally with a |version suffix pinning a version. Exactly one of subjectCanonical, subjectReference and subjectResource is supplied in each repetition.</p>\n</div></td></tr><tr><td>IN</td><td>subject.subjectReference</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/references.html#Reference\">Reference</a> (<a href=\"StructureDefinition-ViewDefinition.html\" title=\"http://hl7.org/fhir/StructureDefinition/ViewDefinition\">View Definition</a>, <a href=\"StructureDefinition-SQLQuery.html\" title=\"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLQuery\">SQL Query Library</a>, <a href=\"StructureDefinition-SQLView.html\" title=\"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLView\">SQL View Library</a>)</td><td/><td><div><p>Literal location of the subject to export: a relative URL on this server, or an absolute URL. Not a canonical URL; use subjectCanonical for that. Exactly one of subjectCanonical, subjectReference and subjectResource is supplied in each repetition.</p>\n</div></td></tr><tr><td>IN</td><td>subject.subjectResource</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/canonicalresource.html\">CanonicalResource</a> (<a href=\"StructureDefinition-ViewDefinition.html\" title=\"http://hl7.org/fhir/StructureDefinition/ViewDefinition\">View Definition</a>, <a href=\"StructureDefinition-SQLQuery.html\" title=\"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLQuery\">SQL Query Library</a>, <a href=\"StructureDefinition-SQLView.html\" title=\"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLView\">SQL View Library</a>)</td><td/><td><div><p>Inline ViewDefinition, SQLQuery Library or SQLView Library to export. Exactly one of subjectCanonical, subjectReference and subjectResource is supplied in each repetition. The declared type is CanonicalResource because ViewDefinition is a logical model rather than a FHIR resource; see Common Operation Behavior (operations-common.html#declared-type).</p>\n</div></td></tr><tr><td>IN</td><td>subject.parameters</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/parameters.html\">Parameters</a></td><td/><td><div><p>Input parameter values for this subject, bound by name to the parameters the Library declares (Library.parameter.name). Permitted only where this repetition's subject is a SQLQuery or SQLView; supplying it where the subject is a ViewDefinition is rejected with 400 Bad Request, because a ViewDefinition declares no parameters.</p>\n</div></td></tr><tr><td>IN</td><td>context</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/canonicalresource.html\">CanonicalResource</a> (<a href=\"StructureDefinition-ViewDefinition.html\" title=\"http://hl7.org/fhir/StructureDefinition/ViewDefinition\">View Definition</a>, <a href=\"StructureDefinition-SQLView.html\" title=\"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLView\">SQL View Library</a>)</td><td/><td><div><p>Supporting artifacts the server cannot itself resolve, supplied inline and matched by canonical URL against the dependencies in the subjects' transitive relatedArtifact graphs. Applies to the job as a whole rather than to one subject, so an artifact several subjects depend on is supplied once. Accepts inline resources only; there is no context by canonical URL, because a URL is exactly what the server has already failed to resolve. A context entry produces no output entry. See Common Operation Behavior (operations-common.html#context).</p>\n</div></td></tr><tr><td>IN</td><td>clientTrackingId</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#string\">string</a></td><td/><td><div><p>Client-provided tracking identifier for the export job, echoed in the manifest.</p>\n</div></td></tr><tr><td>IN</td><td>_format</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#code\">code</a></td><td><a href=\"ValueSet-ExportOutputFormatCodes.html\">Export Output Format Codes</a> (Extensible)</td><td><div><p>Output format for the exported files (csv, ndjson, parquet, json). Optional; if omitted, the server uses ndjson irrespective of Accept. Requesting fhir is rejected with 400 Bad Request, because an export produces flat files. See Common Operation Behavior (operations-common.html).</p>\n</div></td></tr><tr><td>IN</td><td>header</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/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>patient</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/references.html#Reference\">Reference</a></td><td/><td><div><p>Restrict the FHIR resources feeding every subject in the job, before projection, to the supplied patient(s). Where a subject is a SQLQuery or SQLView, that means before the SQL executes. An unresolvable patient is rejected with 400 Bad Request. See Common Operation Behavior (operations-common.html#patient-filter).</p>\n</div></td></tr><tr><td>IN</td><td>group</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/references.html#Reference\">Reference</a></td><td/><td><div><p>Restrict the FHIR resources feeding every subject in the job, before projection, to members of the supplied group(s). Where a subject is a SQLQuery or SQLView, that means before the SQL executes. An unresolvable group is rejected with 400 Bad Request. See Common Operation Behavior (operations-common.html#group-filter).</p>\n</div></td></tr><tr><td>IN</td><td>_since</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#instant\">instant</a></td><td/><td><div><p>Include only resources whose state changed after this instant. See Common Operation Behavior (operations-common.html#since-filter).</p>\n</div></td></tr><tr><td>IN</td><td>source</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#string\">string</a></td><td/><td><div><p>External data source to read from instead of the server's own data (for example a URI or bucket name). Where a subject is a SQLQuery or SQLView, this is where the ViewDefinition tables the query selects from are found.</p>\n</div></td></tr><tr><td>OUT</td><td>exportId</td><td/><td>1..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#string\">string</a></td><td/><td><div><p>Server-generated identifier assigned to the export job.</p>\n</div></td></tr><tr><td>OUT</td><td>clientTrackingId</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#string\">string</a></td><td/><td><div><p>Echoed client tracking identifier when provided.</p>\n</div></td></tr><tr><td>OUT</td><td>status</td><td/><td>1..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#code\">code</a></td><td><a href=\"ValueSet-ExportStatusCodes.html\">Export Status Codes</a> (Required)</td><td><div><p>Status of the export (accepted, in-progress, completed, cancelled, failed).</p>\n</div></td></tr><tr><td>OUT</td><td>location</td><td/><td>1..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#uri\">uri</a></td><td/><td><div><p>URL to poll for export status updates.</p>\n</div></td></tr><tr><td>OUT</td><td>cancelUrl</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#uri\">uri</a></td><td/><td><div><p>Optional URL for cancelling the export.</p>\n</div></td></tr><tr><td>OUT</td><td>_format</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#code\">code</a></td><td><a href=\"ValueSet-ExportOutputFormatCodes.html\">Export Output Format Codes</a> (Extensible)</td><td><div><p>Format of the exported files (echoed from input if supplied).</p>\n</div></td></tr><tr><td>OUT</td><td>exportStartTime</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#instant\">instant</a></td><td/><td><div><p>Timestamp when the export job began.</p>\n</div></td></tr><tr><td>OUT</td><td>exportEndTime</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#instant\">instant</a></td><td/><td><div><p>Timestamp when the export job completed.</p>\n</div></td></tr><tr><td>OUT</td><td>exportDuration</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#integer\">integer</a></td><td/><td><div><p>Duration of the export in seconds.</p>\n</div></td></tr><tr><td>OUT</td><td>estimatedTimeRemaining</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#integer\">integer</a></td><td/><td><div><p>Estimated seconds remaining until completion. Interim polling responses only.</p>\n</div></td></tr><tr><td>OUT</td><td>output</td><td/><td>0..*</td><td/><td/><td><div><p>Output information for each exported subject. Exactly one entry per subject repetition, and none for a context entry. Neither manifest order nor computation order is guaranteed; clients correlate entries by name.</p>\n</div></td></tr><tr><td>OUT</td><td>output.name</td><td/><td>1..1</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#string\">string</a></td><td/><td><div><p>Name assigned to this subject's output, derived from subject.name, else the subject's own name element, else a server-generated identifier.</p>\n</div></td></tr><tr><td>OUT</td><td>output.location</td><td/><td>1..*</td><td><a href=\"http://hl7.org/fhir/6.0.0-ballot5/datatypes.html#uri\">uri</a></td><td/><td><div><p>Download URL(s) for the exported file(s).</p>\n</div></td></tr></table></div>"
},
"extension" : [
{
"url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
"valueCode" : "fhir"
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
"valueInteger" : 2,
"_valueInteger" : {
"extension" : [
{
"url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom",
"valueCanonical" : "http://hl7.org/fhir/uv/sql-on-fhir/ImplementationGuide/hl7.fhir.uv.sql-on-fhir"
}
]
}
},
{
"url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
"valueCode" : "trial-use",
"_valueCode" : {
"extension" : [
{
"url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom",
"valueCanonical" : "http://hl7.org/fhir/uv/sql-on-fhir/ImplementationGuide/hl7.fhir.uv.sql-on-fhir"
}
]
}
}
],
"url" : "http://hl7.org/fhir/uv/sql-on-fhir/OperationDefinition/SQLExport",
"identifier" : [
{
"system" : "urn:ietf:rfc:3986",
"value" : "urn:oid:2.16.840.1.113883.4.642.40.77.33.5"
}
],
"version" : "3.0.0-ballot",
"versionAlgorithmString" : "semver",
"name" : "SQLExport",
"title" : "SQL Export",
"status" : "active",
"kind" : "operation",
"date" : "2026-08-13T15:42:34+00:00",
"publisher" : "HL7 International / FHIR Infrastructure",
"contact" : [
{
"name" : "HL7 International / FHIR Infrastructure",
"telecom" : [
{
"system" : "url",
"value" : "http://www.hl7.org/Special/committees/fiwg"
}
]
}
],
"description" : "Export one or more ViewDefinitions, SQLQuery Libraries and SQLView Libraries as a single asynchronous job, using the FHIR Asynchronous Interaction Request Pattern.",
"jurisdiction" : [
{
"coding" : [
{
"system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
"code" : "001",
"display" : "World"
}
]
}
],
"code" : "sql-export",
"system" : true,
"type" : false,
"instance" : false,
"parameter" : [
{
"name" : "subject",
"use" : "in",
"min" : 1,
"max" : "*",
"documentation" : "One or more artifacts to export, in any mixture of ViewDefinitions, SQLQuery Libraries and SQLView Libraries. Each repetition names a single subject and produces exactly one output entry in the manifest. A request supplying no subject is rejected with 400 Bad Request, as is a request in which two repetitions would produce the same output name.",
"part" : [
{
"name" : "name",
"use" : "in",
"min" : 0,
"max" : "1",
"documentation" : "Name for this subject's output entry in the manifest. Where it is omitted the server uses the subject's own name element, and where the subject declares none, a server-generated identifier. Output names are unique across the job.",
"type" : "string"
},
{
"name" : "subjectCanonical",
"use" : "in",
"min" : 0,
"max" : "1",
"documentation" : "Canonical URL of the ViewDefinition, SQLQuery Library or SQLView Library to export, optionally with a |version suffix pinning a version. Exactly one of subjectCanonical, subjectReference and subjectResource is supplied in each repetition.",
"type" : "canonical",
"targetProfile" : [
🔗 "http://hl7.org/fhir/StructureDefinition/ViewDefinition"🔗 ,
"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLQuery"🔗 ,
"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLView"
]
},
{
"name" : "subjectReference",
"use" : "in",
"min" : 0,
"max" : "1",
"documentation" : "Literal location of the subject to export: a relative URL on this server, or an absolute URL. Not a canonical URL; use subjectCanonical for that. Exactly one of subjectCanonical, subjectReference and subjectResource is supplied in each repetition.",
"type" : "Reference",
"targetProfile" : [
🔗 "http://hl7.org/fhir/StructureDefinition/ViewDefinition"🔗 ,
"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLQuery"🔗 ,
"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLView"
]
},
{
"name" : "subjectResource",
"use" : "in",
"min" : 0,
"max" : "1",
"documentation" : "Inline ViewDefinition, SQLQuery Library or SQLView Library to export. Exactly one of subjectCanonical, subjectReference and subjectResource is supplied in each repetition. The declared type is CanonicalResource because ViewDefinition is a logical model rather than a FHIR resource; see Common Operation Behavior (operations-common.html#declared-type).",
"type" : "CanonicalResource",
"targetProfile" : [
🔗 "http://hl7.org/fhir/StructureDefinition/ViewDefinition"🔗 ,
"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLQuery"🔗 ,
"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLView"
]
},
{
"name" : "parameters",
"use" : "in",
"min" : 0,
"max" : "1",
"documentation" : "Input parameter values for this subject, bound by name to the parameters the Library declares (Library.parameter.name). Permitted only where this repetition's subject is a SQLQuery or SQLView; supplying it where the subject is a ViewDefinition is rejected with 400 Bad Request, because a ViewDefinition declares no parameters.",
"type" : "Parameters"
}
]
},
{
"name" : "context",
"use" : "in",
"min" : 0,
"max" : "*",
"documentation" : "Supporting artifacts the server cannot itself resolve, supplied inline and matched by canonical URL against the dependencies in the subjects' transitive relatedArtifact graphs. Applies to the job as a whole rather than to one subject, so an artifact several subjects depend on is supplied once. Accepts inline resources only; there is no context by canonical URL, because a URL is exactly what the server has already failed to resolve. A context entry produces no output entry. See Common Operation Behavior (operations-common.html#context).",
"type" : "CanonicalResource",
"targetProfile" : [
🔗 "http://hl7.org/fhir/StructureDefinition/ViewDefinition"🔗 ,
"http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/SQLView"
]
},
{
"name" : "clientTrackingId",
"use" : "in",
"min" : 0,
"max" : "1",
"documentation" : "Client-provided tracking identifier for the export job, echoed in the manifest.",
"type" : "string"
},
{
"name" : "_format",
"use" : "in",
"min" : 0,
"max" : "1",
"documentation" : "Output format for the exported files (csv, ndjson, parquet, json). Optional; if omitted, the server uses ndjson irrespective of Accept. Requesting fhir is rejected with 400 Bad Request, because an export produces flat files. See Common Operation Behavior (operations-common.html).",
"type" : "code",
"binding" : {
"strength" : "extensible",
"valueSet" : "http://hl7.org/fhir/uv/sql-on-fhir/ValueSet/ExportOutputFormatCodes"
}
},
{
"name" : "header",
"use" : "in",
"min" : 0,
"max" : "1",
"documentation" : "Include CSV headers (default true). Applies only when csv output is requested.",
"type" : "boolean"
},
{
"name" : "patient",
"use" : "in",
"min" : 0,
"max" : "*",
"documentation" : "Restrict the FHIR resources feeding every subject in the job, before projection, to the supplied patient(s). Where a subject is a SQLQuery or SQLView, that means before the SQL executes. An unresolvable patient is rejected with 400 Bad Request. See Common Operation Behavior (operations-common.html#patient-filter).",
"type" : "Reference"
},
{
"name" : "group",
"use" : "in",
"min" : 0,
"max" : "*",
"documentation" : "Restrict the FHIR resources feeding every subject in the job, before projection, to members of the supplied group(s). Where a subject is a SQLQuery or SQLView, that means before the SQL executes. An unresolvable group is rejected with 400 Bad Request. See Common Operation Behavior (operations-common.html#group-filter).",
"type" : "Reference"
},
{
"name" : "_since",
"use" : "in",
"min" : 0,
"max" : "1",
"documentation" : "Include only resources whose state changed after this instant. See Common Operation Behavior (operations-common.html#since-filter).",
"type" : "instant"
},
{
"name" : "source",
"use" : "in",
"min" : 0,
"max" : "1",
"documentation" : "External data source to read from instead of the server's own data (for example a URI or bucket name). Where a subject is a SQLQuery or SQLView, this is where the ViewDefinition tables the query selects from are found.",
"type" : "string"
},
{
"name" : "exportId",
"use" : "out",
"min" : 1,
"max" : "1",
"documentation" : "Server-generated identifier assigned to the export job.",
"type" : "string"
},
{
"name" : "clientTrackingId",
"use" : "out",
"min" : 0,
"max" : "1",
"documentation" : "Echoed client tracking identifier when provided.",
"type" : "string"
},
{
"name" : "status",
"use" : "out",
"min" : 1,
"max" : "1",
"documentation" : "Status of the export (accepted, in-progress, completed, cancelled, failed).",
"type" : "code",
"binding" : {
"strength" : "required",
"valueSet" : "http://hl7.org/fhir/uv/sql-on-fhir/ValueSet/ExportStatusCodes"
}
},
{
"name" : "location",
"use" : "out",
"min" : 1,
"max" : "1",
"documentation" : "URL to poll for export status updates.",
"type" : "uri"
},
{
"name" : "cancelUrl",
"use" : "out",
"min" : 0,
"max" : "1",
"documentation" : "Optional URL for cancelling the export.",
"type" : "uri"
},
{
"name" : "_format",
"use" : "out",
"min" : 0,
"max" : "1",
"documentation" : "Format of the exported files (echoed from input if supplied).",
"type" : "code",
"binding" : {
"strength" : "extensible",
"valueSet" : "http://hl7.org/fhir/uv/sql-on-fhir/ValueSet/ExportOutputFormatCodes"
}
},
{
"name" : "exportStartTime",
"use" : "out",
"min" : 0,
"max" : "1",
"documentation" : "Timestamp when the export job began.",
"type" : "instant"
},
{
"name" : "exportEndTime",
"use" : "out",
"min" : 0,
"max" : "1",
"documentation" : "Timestamp when the export job completed.",
"type" : "instant"
},
{
"name" : "exportDuration",
"use" : "out",
"min" : 0,
"max" : "1",
"documentation" : "Duration of the export in seconds.",
"type" : "integer"
},
{
"name" : "estimatedTimeRemaining",
"use" : "out",
"min" : 0,
"max" : "1",
"documentation" : "Estimated seconds remaining until completion. Interim polling responses only.",
"type" : "integer"
},
{
"name" : "output",
"use" : "out",
"min" : 0,
"max" : "*",
"documentation" : "Output information for each exported subject. Exactly one entry per subject repetition, and none for a context entry. Neither manifest order nor computation order is guaranteed; clients correlate entries by name.",
"part" : [
{
"name" : "name",
"use" : "out",
"min" : 1,
"max" : "1",
"documentation" : "Name assigned to this subject's output, derived from subject.name, else the subject's own name element, else a server-generated identifier.",
"type" : "string"
},
{
"name" : "location",
"use" : "out",
"min" : 1,
"max" : "*",
"documentation" : "Download URL(s) for the exported file(s).",
"type" : "uri"
}
]
}
]
}