Writing robust data pipelines with AILivestream July 22

Skip to main content

MD_LIST_DIVE_VERSIONS

Returns every version of a single Dive, newest first. Each row carries the version's metadata; fetch a version's component code with MD_GET_DIVE_VERSION.

Syntax

SELECT * FROM MD_LIST_DIVE_VERSIONS(
id := '<dive_id>',
"limit" := <n>,
"offset" := <n>
);

Parameters

ParameterTypeRequiredDescription
idUUIDYesIdentifier of the Dive.
limitUINTEGERNoMaximum number of versions to return.
offsetUINTEGERNoSkip this many versions before returning.

limit and offset collide with SQL keywords and must be quoted with double quotes when passed as named arguments.

Return columns

ColumnTypeDescription
idUUIDIdentifier of the version (not the Dive).
versionUINTEGERVersion number, newest first.
storage_urlVARCHARInternal storage location of the version's content.
descriptionVARCHARDescription attached to the version, or NULL.
created_atTIMESTAMP WITH TIME ZONEWhen the version was created.
api_versionUINTEGERDive API version of the content.
required_resourcesLIST(STRUCT(name VARCHAR, alias VARCHAR, url VARCHAR, id UUID, resource_type VARCHAR))Databases and shares this version queries.

Examples

Get the full version history:

SELECT version, description, created_at
FROM MD_LIST_DIVE_VERSIONS(id := '<dive_id>');

Just the latest version:

SELECT version, created_at
FROM MD_LIST_DIVE_VERSIONS(id := '<dive_id>', "limit" := 1);

Skip the latest, get the rest:

SELECT version
FROM MD_LIST_DIVE_VERSIONS(id := '<dive_id>', "offset" := 1);