Summary
The CLI currently blurs the distinction between spaces and folders. When dremio folder create "foo" is called with a single-component path, it silently rewrites it to CREATE SPACE "foo" SQL. This doesn't match the backend behavior and hides an important semantic difference.
Current behavior
In drs/commands/folder.py (lines 54-62):
async def create_folder(client: DremioClient, path: str) -> dict:
parts = parse_path(path)
if len(parts) == 1:
sql = f'CREATE SPACE "{parts[0]}"' # silently converts to CREATE SPACE
else:
quoted = quote_path_sql(path)
sql = f"CREATE FOLDER {quoted}"
return await run_query(client, sql)
Problems
-
Semantic mismatch: The backend treats spaces and folders as distinct entities. CREATE FOLDER with a single-component path is explicitly rejected by CatalogImpl.validateFolder() with: "Folder path should be fully qualified. Path must include a space or source." The CLI should respect this distinction rather than silently converting.
-
Pre-Space Plugin incompatibility: On projects without Space Plugin enabled, CREATE SPACE SQL doesn't exist, so dremio folder create "foo" would fail with an unhelpful error about unsupported SQL syntax.
-
Missing concept: There is no dremio space command group at all. Spaces are a first-class catalog concept and deserve their own CLI surface.
Proposed changes
-
Add dremio space command group with at least:
dremio space list — list all spaces (filter folder list to containerType: SPACE)
dremio space create <name> — runs CREATE SPACE "<name>"
dremio space delete <name> — deletes a space
dremio space get <name> — get space metadata and children
-
Reject single-component paths in dremio folder create — return an error like: "Cannot create a top-level folder. Use dremio space create <name> to create a space, or provide a fully qualified path like <space>.<folder>."
-
Keep dremio folder list as-is (shows both spaces and sources), or optionally add a --type filter.
Backend reference
CreateSpaceHandler.java — handles CREATE SPACE SQL
CreateFolderHandler.java — handles CREATE FOLDER SQL
CatalogImpl.validateFolder() — rejects single-component folder paths
CatalogOptions.SQL_SPACE_QUERIES_ENABLED — gates CREATE SPACE support (default: true)
Summary
The CLI currently blurs the distinction between spaces and folders. When
dremio folder create "foo"is called with a single-component path, it silently rewrites it toCREATE SPACE "foo"SQL. This doesn't match the backend behavior and hides an important semantic difference.Current behavior
In
drs/commands/folder.py(lines 54-62):Problems
Semantic mismatch: The backend treats spaces and folders as distinct entities.
CREATE FOLDERwith a single-component path is explicitly rejected byCatalogImpl.validateFolder()with: "Folder path should be fully qualified. Path must include a space or source." The CLI should respect this distinction rather than silently converting.Pre-Space Plugin incompatibility: On projects without Space Plugin enabled,
CREATE SPACESQL doesn't exist, sodremio folder create "foo"would fail with an unhelpful error about unsupported SQL syntax.Missing concept: There is no
dremio spacecommand group at all. Spaces are a first-class catalog concept and deserve their own CLI surface.Proposed changes
Add
dremio spacecommand group with at least:dremio space list— list all spaces (filterfolder listtocontainerType: SPACE)dremio space create <name>— runsCREATE SPACE "<name>"dremio space delete <name>— deletes a spacedremio space get <name>— get space metadata and childrenReject single-component paths in
dremio folder create— return an error like: "Cannot create a top-level folder. Usedremio space create <name>to create a space, or provide a fully qualified path like<space>.<folder>."Keep
dremio folder listas-is (shows both spaces and sources), or optionally add a--typefilter.Backend reference
CreateSpaceHandler.java— handlesCREATE SPACESQLCreateFolderHandler.java— handlesCREATE FOLDERSQLCatalogImpl.validateFolder()— rejects single-component folder pathsCatalogOptions.SQL_SPACE_QUERIES_ENABLED— gatesCREATE SPACEsupport (default:true)