Skip to content

Add 'dremio space' commands and reject single-component paths in 'folder create' #13

@sandhyasun

Description

@sandhyasun

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

  1. 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.

  2. 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.

  3. 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

  1. 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
  2. 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>."

  3. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions