Skip to content

feat: a deployment's tables and their wiring, written down - #35

Closed
AlexeyShalaev wants to merge 1 commit into
feat/partition-toolkitfrom
feat/partitions-document
Closed

AlexeyShalaev wants to merge 1 commit into
feat/partition-toolkitfrom
feat/partitions-document

Conversation

@AlexeyShalaev

Copy link
Copy Markdown
Member

Third piece of #32: the multi-table configuration the epic asks for.

PartitionsDocument is every table a deployment maintains, plus the wiring it maintains them through, as one validated model — what a ConfigMap, a mounted YAML or a JSON blob parses into. configs() yields each TablePartitionConfig, config_for(name) one of them, and PartitionToolkit.from_options(engine, document.runtime) builds the collaborators the file describes.

The library still reads no files and opens no connections: parsing belongs to whoever owns the format.

On the "not a parallel model" requirement. PartitionTableSettings is a BaseSettings from an optional extra, and nesting it as a list element makes env semantics strange. So the fields moved into a plain PartitionTableSpec in the core, and PartitionTableSettings now is that model with an environment as its source. One field list, not two — a field added once is available to a file and an environment alike. Its 24 existing tests pass untouched.

ToolkitOptions is the runtime section, one field per keyword of from_engine, with boundary_codec as a name resolved by to_kwargs().

Refused, all for the same reason — each is silent at 03:00 otherwise:

  • an unknown key anywhere, including in defaults, where a typo would reach every table at once;
  • a document with no tables (maintaining nothing is a configuration error, not a successful run);
  • one relation described twice, which would maintain it under two policies in an order the file does not make visible.

defaults merges key by key and only at the top level: a table with its own lifecycle replaces the default one rather than half-inheriting a policy nobody can read off the file.

Stacked on #34.

A deployment maintains several tables in one run and describes them in a
file, not in Python. PartitionsDocument is that file as a model: the tables,
the defaults they start from, and the runtime section that builds the
collaborators -- with PartitionToolkit.from_options taking it directly.

The fields a table entry takes are now one list, not two. PartitionTableSpec
holds them and PartitionTableSettings reads that same model from the
environment, so a field added once is available to a file and an environment
alike.

Unknown keys are refused wherever they appear, defaults included, where a
typo would otherwise reach every table at once; so are a document with no
tables and one relation described twice. Each of those is silent at 03:00
otherwise.

Nothing here reads a file or opens a connection: parsing belongs to whoever
owns the format.
@AlexeyShalaev

Copy link
Copy Markdown
Member Author

Folded into #43, one PR for the whole epic; this branch stays for history.

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.

1 participant