sf_git icon indicating copy to clipboard operation
sf_git copied to clipboard

Get Key error while performing sf_git fetch

Open nagasank opened this issue 1 year ago • 0 comments

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'

nagasank avatar Oct 12 '24 08:10 nagasank