Introducing Flights: agent-native data pipelines in MotherDuckJoin the livestream

Skip to main content

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 alias parquet_scan()

To leverage the MD_RUN parameter, you can choose:

  • MD_RUN=LOCAL executes the function in your local DuckDB environment.
  • MD_RUN=REMOTE executes the function in MotherDuck-hosted DuckDB runtimes in the cloud.
  • MD_RUN=AUTO executes remotely all s3://, http://, https://, s3a://, s3n://, gcs://, gs://, r2://, azure://, az://, abfss://, and hf:// requests, except those to localhost/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.