Skip to content

Define domain.Schema, relational.RelationalSchema, and support presets with backwards compatibility. - #154

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
cl/970150970
Open

Define domain.Schema, relational.RelationalSchema, and support presets with backwards compatibility.#154
copybara-service[bot] wants to merge 1 commit into
mainfrom
cl/970150970

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Aug 24, 2026

Copy link
Copy Markdown

Define domain.Schema, relational.RelationalSchema, and support presets with backwards compatibility.

  • Introduce dpsynth.domain.Schema dataclass implementing Mapping[str, AttributeType] to encapsulate column attribute domains and cross-attribute constraints.
  • Introduce dpsynth.relational.RelationalSchema dataclass to encapsulate relational table schemas and foreign key relationships.
  • Support reusable algorithm presets by accepting schemas at configure/calibration time (configure(schema, ...) and calibrate(schema, ...)).
  • Provide backwards compatibility by preserving optional domain/schema/attribute fields on configuration classes (TabularConfig, BeamTabularConfig, MultiTableConfig, initializers, discrete mechanisms), falling back to them when not provided at configure time.
  • Update MechanismConfig.configure(domain=None, ...) and MechanismConfig.calibrate(domain=None, ...) in api.py to forward domain arguments to polymorphic mechanisms.

@copybara-service copybara-service Bot changed the title Add YAML serialization and deserialization for MechanismConfigs and include etils in packaging dependencies. Add Schema dataclass, YAML serialization for configs and schemas, and refactor TabularConfig into reusable preset. Aug 25, 2026
@copybara-service
copybara-service Bot force-pushed the cl/970150970 branch 2 times, most recently from a62f3d9 to fb8e6c4 Compare August 25, 2026 11:53
@copybara-service copybara-service Bot changed the title Add Schema dataclass, YAML serialization for configs and schemas, and refactor TabularConfig into reusable preset. Add universal serialization for dataclasses, Schema dataclass, and refactor TabularConfig into reusable preset. Aug 25, 2026
@copybara-service
copybara-service Bot force-pushed the cl/970150970 branch 2 times, most recently from 22db8e9 to 11f6cf6 Compare August 25, 2026 12:40
@copybara-service copybara-service Bot changed the title Add universal serialization for dataclasses, Schema dataclass, and refactor TabularConfig into reusable preset. [Breaking change] Define domain.Schema and refactor TabularConfig into reusable preset. Aug 25, 2026
@copybara-service
copybara-service Bot force-pushed the cl/970150970 branch 3 times, most recently from 37d33c8 to 170a419 Compare August 25, 2026 16:03
@copybara-service copybara-service Bot changed the title [Breaking change] Define domain.Schema and refactor TabularConfig into reusable preset. [Breaking change] Define domain.Schema, relational.RelationalSchema, and refactor mechanism configs into reusable presets. Aug 25, 2026
@copybara-service
copybara-service Bot force-pushed the cl/970150970 branch 3 times, most recently from 096e93f to 146703c Compare August 25, 2026 22:16
…s with backwards compatibility.

- Introduce `dpsynth.domain.Schema` dataclass implementing `Mapping[str, AttributeType]` to encapsulate column attribute domains and cross-attribute constraints.
- Introduce `dpsynth.relational.RelationalSchema` dataclass to encapsulate relational table schemas and foreign key relationships.
- Support reusable algorithm presets by accepting schemas at configure/calibration time (`configure(schema, ...)` and `calibrate(schema, ...)`).
- Provide backwards compatibility by preserving optional domain/schema/attribute fields on configuration classes (`TabularConfig`, `BeamTabularConfig`, `MultiTableConfig`, initializers, discrete mechanisms), falling back to them when not provided at configure time.
- Update `MechanismConfig.configure(domain=None, ...)` and `MechanismConfig.calibrate(domain=None, ...)` in `api.py` to forward domain arguments to polymorphic mechanisms.

PiperOrigin-RevId: 970150970
@copybara-service copybara-service Bot changed the title [Breaking change] Define domain.Schema, relational.RelationalSchema, and refactor mechanism configs into reusable presets. Define domain.Schema, relational.RelationalSchema, and support presets with backwards compatibility. Aug 25, 2026

@MuhammadNiazAli MuhammadNiazAli left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The migration in bin/main.py from TabularSynthesizer(domains=...) to TabularConfig(discrete_mechanism=...).calibrate(attribute_domains, ...) lines up cleanly with the new preset-based API described in the PR. The docs update in in_memory_api.md correctly reflects the new configure(schema, ...)/calibrate(schema, ...) signature and the dpsynth.domain import.

I've only looked at these 2 of the 29 changed files so far holding off on approving the whole PR until I've gone through the rest (particularly the actual Schema/RelationalSchema dataclass definitions and the backwards-compatibility fallback logic on TabularConfig/BeamTabularConfig/MultiTableConfig, since that's the riskiest part of this change).

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