Skip to content

feat: add table-references command group - #22

Open
andrewchester-dm wants to merge 2 commits into
mainfrom
feat/DM-4183-table-references-cli
Open

feat: add table-references command group#22
andrewchester-dm wants to merge 2 commits into
mainfrom
feat/DM-4183-table-references-cli

Conversation

@andrewchester-dm

@andrewchester-dm andrewchester-dm commented Aug 18, 2026

Copy link
Copy Markdown

Adds a table-references command group (list/get/create/update/delete) to dm, mirroring the existing connections command group, over `datamasque-python TableReferenceClient.

  • create accepts --file (JSON) or flags for the common case; source is a file path for file connections or schema.table for database connections, with format always explicit, never inferred.
  • update changes only the fields passed; any CSV/format flag replaces options wholesale on the resulting PUT.
  • A 404 from a server that predates table references surfaces as "not supported by this DataMasque version" rather than a generic failure.
    Bumps the datamasque-python floor to >=1.2.5,<2.

@ClassicMMT

Copy link
Copy Markdown
Contributor

Good job looks great!

Left a few small comments of things to look into.

Please make sure you add a PR description and bump dm-python to >=1.2.5.

Comment thread src/datamasque_cli/commands/table_references.py Outdated
Comment thread src/datamasque_cli/commands/table_references.py Outdated
Comment thread src/datamasque_cli/commands/table_references.py Outdated

@ClassicMMT ClassicMMT left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good. Almost there!

Comment thread src/datamasque_cli/commands/table_references.py Outdated
Comment thread src/datamasque_cli/commands/table_references.py Outdated
@andrewchester-dm
andrewchester-dm force-pushed the feat/DM-4183-table-references-cli branch from 7bea2fb to 792ad95 Compare August 24, 2026 01:54

@ClassicMMT ClassicMMT left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved. Just two last things left to make it look a bit better.

Comment on lines +51 to +53
# `datamasque.*` is exempted from mypy's `follow_imports`, so the SDK call resolves to
# `Any` here even though `list_table_references` itself declares `-> list[TableReference]`.
return cast("list[TableReference]", client.list_table_references())

@ClassicMMT ClassicMMT Aug 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
# `datamasque.*` is exempted from mypy's `follow_imports`, so the SDK call resolves to
# `Any` here even though `list_table_references` itself declares `-> list[TableReference]`.
return cast("list[TableReference]", client.list_table_references())
references: list[TableReference] = client.list_table_references()
return references

same thing but looks way better

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done same functional fix

def _get_or_abort(client: DataMasqueClient, name: str) -> TableReference | None:
"""Return the table reference named `name`, or `None`, or abort with the reason the lookup failed."""
try:
return cast("TableReference | None", client.get_table_reference_by_name(name))

@ClassicMMT ClassicMMT Aug 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
return cast("TableReference | None", client.get_table_reference_by_name(name))
reference: TableReference | None = client.get_table_reference_by_name(name)
return reference

or similar variable. Maybe table_reference is better?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Kept reference over table_reference — matches this file's existing convention for a single TableReference

Comment thread README.md
dm libraries usage <name> # Show rulesets using it
```

### Table references

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This section explains a lot compared to the sections above and below. Could you list the commands directly for visual consistency?

Are the commands self-explanatory if the user types dm table-references --help? If not, additional usage information probably belong in SKILL.md

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Trimmed to match sibling sections — Connections/Rulesets/Libraries are all bare command blocks with inline comments, no prose. Checked dm table-references create --help directly: fully self-explanatory (examples + every flag's semantics), so nothing needs moving to SKILL.md

Comment thread CHANGELOG.md Outdated
@@ -1,5 +1,22 @@
# Changelog

## Unreleased

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we name it v.1.6.0? Then we can create a release straight after merging in

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done renamed to v1.6.0

@andrewchester-dm
andrewchester-dm force-pushed the feat/DM-4183-table-references-cli branch from 792ad95 to 8435e54 Compare August 24, 2026 04:45
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.

3 participants