Skip to main content

CREATE FOLDER

Create a new folder in your catalog.

CREATE FOLDER creates a subfolder inside an existing space; it cannot create a top-level entity. All top-level entities in the catalog are spaces, so use CREATE SPACE to create one before creating folders inside it.

To target a specific space, qualify folder_name with the space name and any parent folders, separated by periods (for example, my_space.my_folder). If you give an unqualified name instead, Dremio creates the folder relative to the current context set by the USE command.

Syntax
CREATE FOLDER [ IF NOT EXISTS ] <folder_name>

Parameters

[ IF NOT EXISTS ] Optional

When included, the command runs even if the folder exists and the results indicate that the folder already exists. If this clause is not specified, the command fails if the folder already exists.


<folder_name> String

The name of the folder that you are creating. May be a single name, resolved relative to the current context, or a period-separated path starting with the containing space or source name (for example, my_space.my_folder or my_space.parent_folder.child_folder). The name cannot include the following special characters: /, :, [, or ].


Examples

Create a folder in the current context
CREATE FOLDER myFolder
Create a folder if it doesn't exist
CREATE FOLDER IF NOT EXISTS myFolder
Create nested folders inside a space
CREATE SPACE IF NOT EXISTS StrategicMaterialsDB;
CREATE FOLDER IF NOT EXISTS StrategicMaterialsDB.Sourcing;
CREATE FOLDER IF NOT EXISTS StrategicMaterialsDB.Sourcing.Bronze;