Skip to content

feat: export custom model (like as dbt models .sql)#978

Merged
jschoedl merged 9 commits intodatacontract:mainfrom
AntoineGiraud:feat_export_custom_model
Apr 10, 2026
Merged

feat: export custom model (like as dbt models .sql)#978
jschoedl merged 9 commits intodatacontract:mainfrom
AntoineGiraud:feat_export_custom_model

Conversation

@AntoineGiraud
Copy link
Copy Markdown
Contributor

@AntoineGiraud AntoineGiraud commented Dec 15, 2025

what

Hi, this is a PR to add the --schema_name when we do a custom export

example :
datacontract export tests/fixtures/custom/export/datacontract.yaml --format custom --template tests/fixtures/custom/export_model/template.sql --schema-name line_items

why

i wasn't able to do it previously and it felt odd to have a for loop to export a custom dbt model ... that is supposed to be 1 model per file

to be discused

I tried to update the README.md acordingly

This PR is in draft to open the discusion with materials to chat on

i'm also puzzled on if the "data_contract" passed to the template.file will be an ODCS exclusively
or could it still be the ol' datacontract spec ?!

though for now the method is
def to_custom(data_contract: OpenDataContractStandard, template_path: Path) -> str:

PushToProd checks

  • Tests pass
  • ruff format
  • README.md updated (if relevant)
  •  CHANGELOG.md entry added

@AntoineGiraud AntoineGiraud marked this pull request as ready for review December 15, 2025 17:23
@AntoineGiraud AntoineGiraud changed the title feat: export custom model feat: export custom model (like as dbt models .sql) Jan 23, 2026
AntoineGiraud and others added 5 commits March 19, 2026 13:33
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove redundant DCS-input and staging-template test variants. DCS→ODCS
conversion is handled by the resolution layer, not the exporter, so testing
both input formats here is unnecessary. One ODCS contract, one template,
and one expected output sufficiently cover the schema_name functionality.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…act#978)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jschoedl
Copy link
Copy Markdown
Collaborator

Hi @AntoineGiraud, thank you for your contribution! Sorry, this was lying around here for quite some time now.

I don't think we need such extensive testing for this feature, so I just went ahead and reduced them a bit. Otherwise LGTM, thanks!

@jschoedl jschoedl merged commit ad8b602 into datacontract:main Apr 10, 2026
6 checks passed
@AntoineGiraud
Copy link
Copy Markdown
Contributor Author

Toll ! vielen dank

FYI: the 2 table test was juste to be sure the 2nd model was exported ;)

@AntoineGiraud AntoineGiraud deleted the feat_export_custom_model branch April 10, 2026 10:48
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