To provide additional properties for a query, you may optionally include an associated metadata file for the query.

If supplied, the metadata file should have the same name as the .sql file, but with a ".query.xml" extension (e.g., PeptideCounts.query.xml). For details on setting up the base query, see: Module SQL Queries.

For syntax details, see the following:


See the Examples section of the main query metadata topic.

The sample below adds table- and column-level metadata to a SQL query.

<query xmlns="">
<tables xmlns="">
<table tableName="ResultsSummary" tableDbType="NOT_IN_DB">
<column columnName="Protocol">
<column columnName="Formulation">
<column columnName="DM">
<column columnName="wk1">
<columnTitle>1 wk</columnTitle>
<column columnName="wk2">
<columnTitle>2 wk</columnTitle>

Metadata Overrides

Metadata is applied in the following order:

  • JDBC driver-reported metadata.
  • Module schemas/<schema>.xml metadata.
  • Module Java code creates UserSchema and FilteredTableInfo.
  • Module queries/<schema>/<query>.query.xml metadata.
    • First .query.xml found in the active set of modules in the container.
  • User-override query metadata within LabKey database, specified through the Query Schema Browser.
    • First metadata override found by searching up container hierarchy and Shared container.
  • For LABKEY.QueryWebPart, optional metadata config parameter.
LabKey custom queries will apply the metadata on top of the underlying LabKey table's metadata. A LinkedSchemas may have metadata associated with the definition which will be applied on top of the source schema's metadata. The LinkedSchemas tables and queries may also have module .query.xml and metadata overrides applied using the same algorithm on top of the source schema's tables and queries.

Related Topics





expand all collapse all