Skip to content

Zero fill specific date strings #719 - #728

Merged
kvnkrmr merged 3 commits into
OpenEnergyPlatform:developfrom
kvnkrmr:719-fix-isoformat-string
Apr 2, 2026
Merged

Zero fill specific date strings #719#728
kvnkrmr merged 3 commits into
OpenEnergyPlatform:developfrom
kvnkrmr:719-fix-isoformat-string

Conversation

@kvnkrmr

@kvnkrmr kvnkrmr commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator

Summary of the discussion

When date-typos occur in years (0219 instead of 2019) and we do not pad these values when converting to string, the pandas pd.read_sql call cannot handle three-digit-years, it is simply not a correct isoformat, see #719.

Type of change (CHANGELOG.md)

Updated

  • Added .str.zfill(10) in cast_date_columns_to_string

Workflow checklist

  • I have not yet checked other possible occurences in the code where we handle datetimes
  • I have to workaround the fact that None.str.zfill(10) does not work because 'NoneType' object has no attribute 'str'

Automation

Closes #719

PR-Assignee

Reviewer

  • 🐙 Follow the Reviewer Guidelines
  • 🐙 Provided feedback and show sufficient appreciation for the work done

@kvnkrmr
kvnkrmr marked this pull request as draft March 26, 2026 16:20
@kvnkrmr
kvnkrmr requested review from FlorianK13 and nesnoj March 30, 2026 13:47
@kvnkrmr
kvnkrmr marked this pull request as ready for review March 30, 2026 13:47
@FlorianK13

Copy link
Copy Markdown
Member

@pt-kkraemer did you run the tests locally? Because of the problem described in #729 the tests do not trigger, but it is also annoying to always commit some super small changes just to trigger the tests.

@kvnkrmr

kvnkrmr commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator Author

Output from pytest tests/ -v

grafik

and here the outputs from the five failed tests:

grafik
  • The first three fails are expected I guess?
  • I will be investigating the test_Mastr_translate fail, it seems to be a windows specific problem with the local DB connection:[ERROR] An error occurred while renaming database: [WinError 32] Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: 'C:\\Users\\kkrae\\.open-MaStR\\data\\sqlite\\mastr-test.db' -> 'C:\\Users\\kkrae\\.open-MaStR\\data\\sqlite\\mastr-test-translated.db'
  • And the last error stems from looking for a .xml that is not downloaded anyway, should I rewrite the test?

@FlorianK13

Copy link
Copy Markdown
Member

No, we will need to update tests anyway. Can you delete/move everything from .open-mastr/data and then run the tests? At least the missing xml file test should not fail then anymore.

@kvnkrmr

kvnkrmr commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator Author

Yes:
grafik

@FlorianK13

Copy link
Copy Markdown
Member

@pt-kkraemer lgtm - you can merge if you want.

@kvnkrmr
kvnkrmr merged commit ecd2816 into OpenEnergyPlatform:develop Apr 2, 2026
2 checks passed
@kvnkrmr
kvnkrmr deleted the 719-fix-isoformat-string branch April 2, 2026 08:12
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.

ERROR Failed to process table market_actors: Invalid isoformat string: '201-10-01'

2 participants