vanna icon indicating copy to clipboard operation
vanna copied to clipboard

Edge cases for ask() when df has length 1 and print_result = False

Open danendral opened this issue 1 year ago • 1 comments

src/vanna/init.py Line 1525: return sql, df, fig, None When df has length 1 and print_result = False, fig is not yet defined.

Thus, it will return the error:

Couldn't run plotly code: cannot access local variable 'fig' where it is not associated with a value Traceback (most recent call last): File "c:...\myenv\Lib\site-packages\vanna_init_.py", line 1525, in ask return sql, df, fig, None ^^^ UnboundLocalError: cannot access local variable 'fig' where it is not associated with a value

Need to take care of this case and return None instead of fig

danendral avatar Oct 16 '23 10:10 danendral

Thanks for reporting! This is indeed a bug

zainhoda avatar Oct 17 '23 01:10 zainhoda