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

Key Error 'einheitenaenderungnetzbetreiberzuordnungen' #569

Closed
AhmadShelbayeh opened this issue Sep 30, 2024 · 7 comments
Closed

Key Error 'einheitenaenderungnetzbetreiberzuordnungen' #569

AhmadShelbayeh opened this issue Sep 30, 2024 · 7 comments
Assignees

Comments

@AhmadShelbayeh
Copy link

AhmadShelbayeh commented Sep 30, 2024

Description of the issue

Hey guys, I am getting a key error when downloading the Bulk data.
Code:
from open_mastr import Mastr
db = Mastr()
today_date = datetime.now().strftime('today')
db.download(method='bulk', data=["wind", "market", "permit", "deleted_units"], date=today_date)

KeyError: 'einheitenaenderungnetzbetreiberzuordnungen'

Steps to Reproduce

Ideas of solution

Context and Environment

Version used: 0.14.3. and 0.14.4.
Environment setup and (python) version: 3.11. & 3.12.

@FlorianK13
Copy link
Member

Hi @AhmadShelbayeh
Based on this code line I assume that we have fixed this already. However a usual problem is that new versions of the database scheme are not initialized if an old database still exists. One solution should be that you delete your sqlite database (or the whole~/.open-mastr folder) and rerun your code.

If this does not work, you can answer again in this issue.

@FlorianK13 FlorianK13 self-assigned this Sep 30, 2024
@AhmadShelbayeh
Copy link
Author

AhmadShelbayeh commented Sep 30, 2024

@FlorianK13
Unfortunately, I deleted the entire folder and reran the code, but I am still encountering the same error. It seems the issue was not resolved by deleting the folder. Could you please help me troubleshoot this problem?

@AhmadShelbayeh
Copy link
Author

AhmadShelbayeh commented Sep 30, 2024

@FlorianK13

This is the error:

Download has started, this can take several minutes.The download bar is only a rough estimate.
C:\Users\ahmad.shelbayeh.open-MaStR\data\xml_download\Gesamtdatenexport_20240930.zip: 19149 [09:20, 34.19/s]
Download is finished. It took 560 seconds.
MaStR was successfully downloaded to C:\Users\ahmad.shelbayeh.open-MaStR\data\xml_download.
Table 'wind_eeg' is filled with data 'anlageneegwind' from the bulk download.
File 'AnlagenEegWind.xml' is parsed.
Data is cleansed.
Traceback (most recent call last):

Cell In[1], line 13
db.download(method='bulk', data=[

File D:\Prog.cpy\Data\Anaconda3\envs\Ahmad\lib\site-packages\open_mastr\mastr.py:231 in download
write_mastr_xml_to_database(

File D:\Prog.cpy\Data\Anaconda3\envs\Ahmad\lib\site-packages\open_mastr\xml_download\utils_write_to_database.py:34 in write_mastr_xml_to_database
if is_table_relevant(

File D:\Prog.cpy\Data\Anaconda3\envs\Ahmad\lib\site-packages\open_mastr\xml_download\utils_write_to_database.py:76 in is_table_relevant
tablename_mapping[xml_tablename]["class"] is not None

KeyError: 'einheitenaenderungnetzbetreiberzuordnungen'

@FlorianK13
Copy link
Member

And your version right now is 0.14.4? Because 0.14.3 would initialize the old database schema.

@AhmadShelbayeh
Copy link
Author

AhmadShelbayeh commented Sep 30, 2024

@FlorianK13
How can I know my version, is it by run pip install --upgrade open-mastr, if yes my version is:
open-mastr in d:\prog.cpy\data\anaconda3\envs\ahmad\lib\site-packages (0.14.1)
how can solve it?

@FlorianK13
Copy link
Member

Then you need to run pip install --upgrade open-mastr

@AhmadShelbayeh
Copy link
Author

@FlorianK13
it works, thanks

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

No branches or pull requests

2 participants