Skip to content

feat: full CRUD coverage for all Dremio objects#2

Merged
rahim-bhojani merged 4 commits intomainfrom
draft/drs-spike
Mar 17, 2026
Merged

feat: full CRUD coverage for all Dremio objects#2
rahim-bhojani merged 4 commits intomainfrom
draft/drs-spike

Conversation

@rahim-bhojani
Copy link
Copy Markdown
Contributor

Summary

  • 47 commands across 10 command groups (up from 21 commands / 6 groups)
  • 105 tests all passing (up from 73)
  • Every Dremio object now has consistent CRUD operations through CLI subcommands — users no longer need to guess whether to use a CLI command or raw SQL

New command groups

Group Commands API
drs engine list, get, create, update, delete, enable, disable v0 engine endpoints
drs user list, get, invite, update, delete v1 user endpoints
drs role list, get, create, update, delete v1 role endpoints
drs grant get, set, remove v1 grant endpoints

Extended existing groups

Group New commands
drs catalog create-space, create-folder, delete
drs schema set-wiki, set-tags
drs reflect create

Other changes in this branch

  • ASL 2.0 copyright headers on all files (replaces proprietary header)
  • Removed user/password auth (not supported in Dremio Cloud)
  • Fixed all API endpoint paths for Dremio Cloud (/v0/projects/{pid}/...)
  • Fixed system table names (sys.project.jobs, sys.project.reflections)
  • README updated with CRUD coverage matrix, API endpoint table, examples

Design principle

All mutations go through the REST API, not SQL. The only exception is DDL for tables/views (CREATE VIEW, ALTER TABLE, etc.) which is inherently SQL — use drs query run for those.

Test plan

  • All 105 unit tests pass (uv run pytest tests/ -q)
  • Smoke test new CRUD commands against live Dremio Cloud (engine, user, role, grant, catalog create/delete, reflect create, schema set-wiki/set-tags)
  • Verify drs describe <command> returns correct schemas for all 47 commands
  • Test --dry-run flag on all destructive operations

🤖 Generated with Claude Code

Adds consistent create/update/delete operations so users never need to
guess whether to use a CLI subcommand or raw SQL for a given object.

New command groups:
- drs engine (list/get/create/update/delete/enable/disable)
- drs user (list/get/invite/update/delete)
- drs role (list/get/create/update/delete)
- drs grant (get/set/remove)

Extended existing groups:
- catalog: create-space, create-folder, delete
- schema: set-wiki, set-tags
- reflect: create

Client: added _put helper, catalog mutations, wiki/tag setters,
reflection creation, engine CRUD, user/role CRUD, grant management.

47 commands total (up from 21), 105 tests (up from 73).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rahim-bhojani
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a91c155f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

async def _put(self, url: str, json: dict | None = None) -> Any:
resp = await self._client.put(url, json=json)
resp.raise_for_status()
return resp.json()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Handle empty PUT responses before JSON decoding

The new _put helper always returns resp.json() after raise_for_status(), but several newly added flows call PUT for control operations (for example engine enable/disable and grant updates) where a successful response can be empty; when that happens, resp.json() raises JSONDecodeError and the CLI reports a failure even though the API call succeeded. This should mirror _delete by checking resp.content before decoding.

Useful? React with 👍 / 👎.

Comment on lines +114 to +115
except httpx.HTTPStatusError:
pass
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate non-404 prefetch errors in schema updates

set_wiki swallows every HTTPStatusError from the pre-read (get_wiki) and falls back to version=None (and set_tags repeats the same pattern), which means authorization/server failures are treated like “no existing wiki/tags” and the write proceeds without the expected concurrency version. In cases like transient 5xx or permission issues, this can cause misleading behavior and accidental overwrite attempts; only 404 should be ignored while other statuses should be surfaced via handle_api_error.

Useful? React with 👍 / 👎.

rahim-bhojani and others added 3 commits March 12, 2026 21:09
…s only swallow 404

P1: _put now checks resp.content before JSON decode, matching _delete
behavior. Prevents JSONDecodeError on engine enable/disable and grant
updates that return empty 200 responses.

P2: set_wiki/set_tags prefetch now only catches 404 (no existing
wiki/tags). Auth failures and 5xx are propagated via handle_api_error
instead of being silently ignored.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…consistent CRUD verbs

- Binary: drs → dremio
- catalog → folder (create uses SQL: CREATE SPACE / CREATE FOLDER)
- reflect → reflection (drop → delete, status → get)
- jobs → job
- access commands split: whoami/audit → user, grants → folder
- schema wiki/tags split into separate wiki and tag groups
- set → update, remove → delete for consistent CRUD verbs
- search promoted to top-level command
- Delete old command files (catalog, reflect, access, jobs)
- Update README with new commands, install instructions, CRUD matrix

107 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… stale docs

- Retry up to 3 times on timeouts and 429/502/503/504 with 1s/2s/4s backoff
- No retry on client errors (4xx except 429)
- Remove ARCHITECTURE_REVIEW.md and ONE_PAGER.md (stale spike artifacts)
- 8 new retry tests (115 total passing)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rahim-bhojani rahim-bhojani merged commit f0c42d9 into main Mar 17, 2026
aniket-s-kulkarni added a commit to aniket-s-kulkarni/dremio-cli that referenced this pull request Mar 25, 2026
- Regenerate corrupted uv.lock (TOML parse error at pre-commit entry)
- Fix all ruff lint violations: StrEnum, Optional→X|None, import order,
  collections.abc, contextlib.suppress, Path.open
- Apply ruff format to all files
- Fix SSE parser to flush leftover buf content when stream closes
  without trailing newline (review comment dremio#2)
- Add conversations key fallback in _chat_output so payloads shaped as
  {"conversations": [...]} render correctly (review comment dremio#1)
- Add test for SSE no-trailing-newline edge case

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant