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

Get Key error while performing sf_git fetch #21

Open
nagasank opened this issue Oct 12, 2024 · 0 comments
Open

Get Key error while performing sf_git fetch #21

nagasank opened this issue Oct 12, 2024 · 0 comments

Comments

@nagasank
Copy link

Getting worksheets

This error while debugging can be fixed by commenting out:
`

for i, _ in enumerate(worksheets):
        content = contents[worksheets[i]._id]
        if "query" in content.keys():
            worksheets[i].content = content["query"]
        # elif "drafts" in content.keys():
        #     draft_ids = [draft_id for draft_id in content["drafts"].keys()]
        #     if len(draft_ids) > 0:
        #         if len(draft_ids) > 1:  # keys are timestamps
        #             last_update_id = str(
        #                 max([int(draft_id) for draft_id in draft_ids])
        #             )
        #         else:
        #             last_update_id = draft_ids[0]
        #         worksheets[i].content = content["drafts"][last_update_id][
        #             "query"
        #         ]
        #     else:
        #         worksheets[i].content = ""
        else:
            worksheets[i].content = ""
 
    if store_to_cache:
        save_worksheets_to_cache(worksheets)

`

Traceback (most recent call last):
File "C:\Users\nagas\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\nagas\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\nagas\Documents\GitHub\snowflake_notebooks\venv\Scripts\sfgit.exe_main
.py", line 7, in
File "C:\Users\nagas\Documents\GitHub\snowflake_notebooks\venv\lib\site-packages\click\core.py", line 829, in call
return self.main(*args, **kwargs)
File "C:\Users\nagas\Documents\GitHub\snowflake_notebooks\venv\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "C:\Users\nagas\Documents\GitHub\snowflake_notebooks\venv\lib\site-packages\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\nagas\Documents\GitHub\snowflake_notebooks\venv\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\nagas\Documents\GitHub\snowflake_notebooks\venv\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "C:\Users\nagas\Documents\GitHub\snowflake_notebooks\venv\lib\site-packages\sf_git\cli.py", line 161, in fetch_worksheets
sf_git.commands.fetch_worksheets_procedure(
File "C:\Users\nagas\Documents\GitHub\snowflake_notebooks\venv\lib\site-packages\sf_git\commands.py", line 235, in fetch_worksheets_procedure
worksheets = sf_get_worksheets(
File "C:\Users\nagas\Documents\GitHub\snowflake_notebooks\venv\lib\site-packages\sf_git\worksheets_utils.py", line 94, in get_worksheets
worksheets[i].content = content["drafts"][last_update_id][
KeyError: 'query'

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

1 participant