Writing robust data pipelines with AILivestream July 22

Skip to main content

MD_LIST_DIVES

Lists all Dives in your MotherDuck account. Returns metadata for each Dive without the component content.

Syntax

SELECT * FROM MD_LIST_DIVES();
SELECT * FROM MD_LIST_DIVES("limit" =100, "offset" =0);

Parameters

ParameterTypeRequiredDescription
limitUINTEGERNoMaximum number of Dives to return
offsetUINTEGERNoNumber of Dives to skip
include_org_sharesBOOLEANNoInclude Dives shared with your organization. Defaults to false.
tip

limit and offset are reserved SQL keywords and must be double-quoted when used as named parameters.

Return columns

ColumnTypeDescription
idUUIDUnique identifier of the Dive
titleVARCHARDive title
descriptionVARCHARDive description
owner_idUUIDUUID of the Dive owner
current_versionINTEGERLatest version number (1-based)
created_atTIMESTAMP WITH TIME ZONEWhen the Dive was created
updated_atTIMESTAMP WITH TIME ZONEWhen the Dive was last updated
owner_nameVARCHARName of the Dive owner
statusVARCHARThe Dive's status: draft, ready, endorsed, or archived
status_changed_atTIMESTAMP WITH TIME ZONEWhen the status was last set (NULL until someone sets it)
status_set_byUUIDUUID of the user who set the status (NULL until someone sets it)
status_applies_to_versionUINTEGERThe version the status was set against (NULL until someone sets it)

Examples

List all Dives:

SELECT * FROM MD_LIST_DIVES();

List the 10 Dives with the latest updates:

SELECT id, title, owner_name, updated_at
FROM MD_LIST_DIVES()
ORDER BY updated_at DESC
LIMIT 10;

List endorsed Dives:

SELECT id, title, owner_name, status_changed_at
FROM MD_LIST_DIVES()
WHERE status = 'endorsed';

Paginate through Dives:

SELECT * FROM MD_LIST_DIVES("limit" =20, "offset" =0);  -- first page
SELECT * FROM MD_LIST_DIVES("limit" =20, "offset" =20); -- second page