Skip to content

feat: add SetsClient for persistent saved sets - #17

Merged
RatulMaharaj merged 1 commit into
mainfrom
feat/sets-client
Jun 24, 2026
Merged

feat: add SetsClient for persistent saved sets#17
RatulMaharaj merged 1 commit into
mainfrom
feat/sets-client

Conversation

@gtchax

@gtchax gtchax commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a SetsClient to the Python SDK so users (and DataMaker sandbox scripts) can manage sets — persistent, named snapshots of generated/fetched rows (e.g. a pinned regression dataset or a shared fixture). This is the SDK half of the new Sets feature in the main DataMaker app; the /sets CRUD API it talks to already exists server-side.

What's included

  • routes/sets.pySetsClient with the full CRUD surface:
    • get_sets(project_id=None) — list (scoped by project; falls back to DATAMAKER_PROJECT_ID)
    • get_set(set_id) — fetch one, including its full data payload
    • create_set(name, data=None, description=None, row_count=None, project_id=None)
    • update_set(set_id, ...) — sends only provided fields
    • delete_set(set_id)
    • save_set(name, data, description=None, project_id=None) — convenience for the common "save these rows as a named set" flow, pulling project context from DATAMAKER_PROJECT_ID when omitted
  • Wired into routes/__init__.py and main.py (delegating methods on the top-level DataMaker client + a .sets property for direct access), mirroring the existing resource clients.
  • TestSetsClient unit tests covering list (scoped/unscoped), get, create (full/minimal/env-fallback/validation), update, delete, and save_set.
  • A Set Management section in llms.txt.

Usage

dm = DataMaker()
rows = dm.generate(template)
result = dm.save_set("nightly-regression", rows)
print(f"Saved set: {result['name']} ({result['rowCount']} rows)")

Testing

Full unit suite green locally — 62 passed, 24 skipped (integration tests skip without a live API key). ruff format clean on the new/changed files.

🤖 Generated with Claude Code

Adds a SetsClient mirroring the other resource clients, exposing the
/sets CRUD API plus a save_set() convenience for the common "save these
rows as a named set" flow:

- get_sets / get_set / create_set / update_set / delete_set / save_set
- project_id falls back to DATAMAKER_PROJECT_ID (convenient in sandbox envs)
- wired into routes/__init__.py and main.py (delegating methods + .sets property)
- TestSetsClient unit tests + a Set Management section in llms.txt

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@RatulMaharaj
RatulMaharaj merged commit fd20fe5 into main Jun 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants