⌘K ctrl+k
Search Shortcut cmd + k | ctrl + k

REGISTER EXTERNAL RESOURCE Statement

New The REGISTER EXTERNAL RESOURCE statement was introduced in DuckDB 2.0.0.

The REGISTER EXTERNAL RESOURCE statement adopts an underlying resource by its handle, and creates a resource registration for it under a name. The handle is the MAP(VARCHAR, VARCHAR) that the create callback of the external resource type returns for the underlying resource. The create callback is not called: DuckDB calls the status callback with the handle until it reports ready, and the endpoint of the resource registration is the one the status callback reports. See Lifecycle Callbacks.

A resource registration created with REGISTER EXTERNAL RESOURCE is used and torn down like one created with CREATE EXTERNAL RESOURCE: DESTROY EXTERNAL RESOURCE calls the destroy callback of its external resource type.

Note REGISTER EXTERNAL RESOURCE is refused when enable_external_access is false. See Restrictions.

Syntax

REGISTER EXTERNAL RESOURCE type AS name FROM handle;

type is the name of a registered external resource type, written as described in External Resource Type Names. handle is an expression. name is the name of the resource registration.

Examples

Create a resource registration from a handle. The create callback of the external resource type, r_create, does not exist; it is not called:

CREATE MACRO r_status(h) AS TABLE
    SELECT 'ready' AS state, MAP {'uri': ':memory:', 'attached_db_type': 'duckdb'} AS result;
CALL register_external_resource_type(
    'mem@local',
    kind := 'catalog',
    create_function := 'r_create',
    status_function := 'r_status'
);
REGISTER EXTERNAL RESOURCE 'mem@local' AS existing FROM MAP {'id': 'm1'};
SELECT name, type, managed FROM (SHOW EXTERNAL RESOURCES);
name type managed
existing mem@local true
© 2026 DuckDB Foundation, Amsterdam NL
DuckDB Home Code of Conduct Trademark Use Blog