MD_RUN parameter
For certain DuckDB Table Functions, MotherDuck provides an additional parameter, MD_RUN, that gives explicit control over where the query is executed.
This parameter is available to the following functions:
read_csv()read_csv_auto()read_json()read_json_auto()read_parquet()and its aliasparquet_scan()
To leverage the MD_RUN parameter, you can choose:
MD_RUN=LOCALexecutes the function in your local DuckDB environment.MD_RUN=REMOTEexecutes the function in MotherDuck-hosted DuckDB runtimes in the cloud.MD_RUN=AUTOexecutes remotely alls3://,http://,https://,s3a://,s3n://,gcs://,gs://,r2://,azure://,az://,abfss://, andhf://requests, except those tolocalhost/127.0.0.1. This is the default option.
The following is an example of using this parameter to execute the function remotely:
SELECT *
FROM read_csv(
'https://raw.githubusercontent.com/duckdb/duckdb-web/main/data/weather.csv',
MD_RUN = REMOTE
);
In this example, MD_RUN=REMOTE is redundant because omitting it implies MD_RUN=AUTO, and given that this is a non-local https:// resource, MotherDuck will automatically choose remote execution already.
You can force local execution with MD_RUN=LOCAL.