-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate python code for schemas directly from Julia #1096
Conversation
3407f62
to
ce4b863
Compare
No intermediate json file. WIP: Only creates classes off of AbstractRecord, no defaults yet and more is missing.
Doesn't use the intermediate json schemas anymore.
No more intermediate schema.json step
Use Optional[] instead of union | None for pandera to understand.
ce4b863
to
aebcbf0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good improvement, thanks!
The error message from #904 has gotten a lot better, pointing at the actual problem:
>>> import ribasim
>>> import pandas as pd
>>> ribasim.Terminal(static=pd.DataFrame(data={"no_id":[1]}))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Ribasim\.pixi\env\Lib\site-packages\pydantic\main.py", line 171, in __init__
self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Terminal
static.df
Value error, column 'node_id' in DataFrameSchema {'node_id': <Schema Column(name=node_id, type=DataType(int64))>} requires a default value when non-nullable add_missing_columns is enabled [type=value_error, input_value= no_id
0 1, input_type=DataFrame]
For further information visit https://errors.pydantic.dev/2.6/v/value_error
Still I wonder how many users will understand "requires a default value when non-nullable add_missing_columns is enabled", instead of something simply stating that a required column is missing.
Remove intermittent json generation and dependency on the data model code generator
Fixes #904
Fixes #1077
Fixes #887