cowprotocol / dune-bridge

Other
4 stars 3 forks source link

Fix: update_app_data #8

Closed bh2smith closed 2 years ago

bh2smith commented 2 years ago

PR #6 introduced an undesired change that was not the original intention of the update_app_data script. That is, it was only executing a fixed query (without updating the values).

In this PR we fix that, but also add a follow up query that parses the JSON content from the view into an actual table of app data.

josojo commented 2 years ago

Thanks, yes, this task was indeed left behind.

Somehow I am not able to run this PR.

 python -m dune_api_scripts.update_appdata_view
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.10/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/python@3.10/3.10.0_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/alexherrmann/cow/dune-bridge/dune_api_scripts/update_appdata_view.py", line 30, in <module>
    dune.initiate_query(app_data_query)
  File "/Users/alexherrmann/cow/dune-bridge/dune_api_scripts/env/lib/python3.10/site-packages/duneapi/api.py", line 122, in initiate_query
    validate_and_parse_dict_response(response, post_data.key_map)
  File "/Users/alexherrmann/cow/dune-bridge/dune_api_scripts/env/lib/python3.10/site-packages/duneapi/response.py", line 44, in validate_and_parse_dict_response
    assert isinstance(
AssertionError: Invalid response type <class 'NoneType'>

Is this due to the fact that I have the wrong user? Maybe a testplan would help me to figure it out. My test did not even work out after updating the package

bh2smith commented 2 years ago

Yes, I guess we should change the query ids to one's owned by the account used for this project. I've noticed that this project uses your credentials, perhaps it should all be switched to the cowbackend account.

bh2smith commented 2 years ago

The response type being none isn't a great message to get back for invalid user credentials. Might be a good issue to report on duneapi.

bh2smith commented 2 years ago

@josojo - check out the most recent commit. Consolidating the two queries and changing the query ID to one owned by this project's dune account.

bh2smith commented 2 years ago

Hey @josojo this is ready.