Skip to content
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

Try to migrate the existing database, by adding missing columns #191

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

maurerle
Copy link
Member

supports float and text columns
simplifies database engine usage as pandas now fully supports sqlalchemy v2

fixes #188

@maurerle maurerle changed the title This tries to migrate the existing database, by adding missing columns Try to migrate the existing database, by adding missing columns Sep 15, 2023
@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: -0.29% ⚠️

Comparison is base (fd574b0) 79.35% compared to head (3588ec7) 79.07%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #191      +/-   ##
==========================================
- Coverage   79.35%   79.07%   -0.29%     
==========================================
  Files          40       40              
  Lines        4026     4047      +21     
==========================================
+ Hits         3195     3200       +5     
- Misses        831      847      +16     
Flag Coverage Δ
pytest 79.07% <50.00%> (-0.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
assume/common/forecasts.py 86.99% <ø> (ø)
assume/common/outputs.py 81.34% <42.85%> (-7.03%) ⬇️
assume/world.py 84.35% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

If a simulation before has been started which does not include an additional field
we try to add the field.
For now, this only works for float and text.
An alternative which finds the correct types would be to use
Copy link
Member

Choose a reason for hiding this comment

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

What other types there might be? anyway we cannot write dicts or enything else.

Copy link
Member Author

Choose a reason for hiding this comment

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

we do not detect bool or datetime values. But for most use cases it will be enough

Copy link
Member

Choose a reason for hiding this comment

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

so maybe we can for now add a raise if the type is not detected? so we see if the problem ever occurs. Or it won't work anyway?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the field is bool (0 or 1) or int, we will add it as float numeric.
Datetime might be added as unix timestamp numeric or raise an error.

This will probably be enough to visualize the values, even if it is not the proper datatype.
And in other cases it will raise anyway. So I don't think we need additional error raising

@maurerle maurerle merged commit dd9c0e9 into main Sep 15, 2023
@maurerle maurerle deleted the db_migration branch September 15, 2023 13:01
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.

Writing to db of comlex orders after running a simple simulation before that doesn't work
2 participants