516 dynamic tables and columns#718
516 dynamic tables and columns#718Simon-Will wants to merge 37 commits intoOpenEnergyPlatform:developfrom
Conversation
c85c1fe to
fc5bfec
Compare
8550e9a to
f31622c
Compare
68eb2ad to
2158b8a
Compare
|
On 19.02.2026 a new public version of the Gesamtdatenexport will have a bugfix concerning attributes in the .xsd files: This will probably have no effect on what you have done already right? |
|
Interesting, thanks for pointing that out, @pt-kkraemer! It shouldn't make any difference for now because we make all attributes except the primary keys nullable anyway. But I'll be sure to check out the difference in the XSD files to make sure I understand that point correctly. As for this whole PR, it's almost ready now as you can see from the checklist. If anyone already has comments on the approach, please let them be heard. I don't think I will make substantial changes to the non-testing code anymore. |
|
Hi @FlorianK13 and @pt-kkraemer, thanks a lot for your reviews and suggestions! I addressed your comments with the two latest commits. Could you have another look? |
|
I just had the same error as #723 when using the latest pull from your fork @Simon-Will. @FlorianK13 wrote in #723 that this will be fixed, I don't think it does. Maybe we can talk about this in our next dev-meeting? |
|
All discussions resolved. I'm waiting for the 0.17 release and will then update this branch before it can be merged. :) |
|
@Simon-Will can you resolve the conflicts? Afterwards I think we can merge. |
|
@FlorianK13, conflicts resolved. I'm running the download & import right now to see if it goes well. |
|
The import is going well. So this is ready again, but I think we want to do #736 first. |
|
I merged develop into this pull request branch again. So it's ready for merge again. To whoever wants to merge: I'd recommend squashing all these commits I made. The history isn't really clean enough to be useful imo. |
As discussed we want to extend the changelog
FlorianK13
left a comment
There was a problem hiding this comment.
@Simon-Will can look at my comment and do this change to the CHANGELOG if you agree with the described changes there? Afterwards I an squash commit merge the PR.
|
|
||
| ## [v0.xx.x] Unreleased - 202x-xx-xx | ||
| ### Added | ||
| - Add the option to pass a custom database schema |
There was a problem hiding this comment.
We discussed in a call and @nesnoj pointed out if we can use a LLM to generate an extended changelog - since a lot of stuff happend here. I did this and it created this new changelog:
[v0.xx.x] Unreleased - 202x-xx-xx
Added
- Add
Mastr.generate_data_modelmethod that downloads the current MaStR documentation and generates SQLAlchemy tables from the XSD definitions; supportsenglish=Truefor English column
names
#718 - Add
mastr_table_to_db_tableargument toMastr.downloadto pass a custom database schema
#718 - Add
alter_database_tablesargument toMastr.downloadto prevent open-mastr from issuing DDL statements
#718
Changed
- Switch to dynamic table generation based on parsing of XSD files from the MaStR documentation; fall back to bundled XSD files if the downloaded documentation is invalid
#718 - Change default table and column names to align more closely with the original MaStR export file names
#718 - Simplify CSV export by removing cross-table joins; tables are exported as-is
#718
Removed
- Remove
Mastr.translate; English table and column names are now available via theenglish=Trueparameter ingenerate_data_modelanddownload
#718


A first attempt at creating tables based on the MaStR XSD files.
Checklist until this is really ready:
mastr_table_to_db_modelreturned fromMastr.generate_data_model. E.g. by adding a function that generates a Python code snippet with the SQLALchemy models/tables.Mastr.generate_data_modelreturn SQLAlchemy core tables, not ORM models. They are easy to just print and a user can then copy them to their code & modify them. They are also the best common ground. After all, some users might not use the ORM.format_mastr_table_to_db_tablethat makes printing easy for the user.utils_download_bulk.pybecause I found date handling unnecessarily complex. Add interactive download functionality for MaStR date selection #696 #697 changes the same code and adds support for retrieving available XML download dates. If Add interactive download functionality for MaStR date selection #696 #697 is merged, we have to update this retrieval logic to also retrieve the documentation download dates.Type of change (CHANGELOG.md)
Added
Mastr.generate_data_modelthat downloads the newest MaStR documentation and uses the XSD file to build SQLAlchemy models from the contained definitionsUpdated
Mastr.downloadwith two optional new argumentsmastr_table_to_db_table, with which the user can pass their own database schema, andalter_database_tables, with which the user can preventopen-mastrfrom issuing any DDL statements.Removed
Mastr.translate. The user can now get English table and column names by passingenglish=Trueto thegenerate_data_modelordownloadmethod.Workflow checklist
Automation
Closes #516
Closes #577
PR-Assignee
Reviewer