basedpyright icon indicating copy to clipboard operation
basedpyright copied to clipboard

Ignore %sql cells

Open aersam opened this issue 9 months ago • 5 comments

Description

basedpyright type checks %sql cells in jupyter notebooks, which leads to unnecessary errors

aersam avatar May 13 '25 13:05 aersam

If you give me a hint where to do this in the source, I could do a PR, I do TypeScript once in a while

aersam avatar May 13 '25 13:05 aersam

i'm not very familiar with jupyter notebooks. is this what you mean by %sql cells?

Image

pylance seems to have the same issue: https://github.com/microsoft/pylance-release/issues/4969

interestingly, this other syntax with %%sql seems to work but %sql doesn't:

Image

DetachHead avatar May 13 '25 13:05 DetachHead

In databricks you're allowed to do cells like this:

Image

%%sql is not the same in databricks, one should use %sql

aersam avatar May 13 '25 14:05 aersam

could you provide a bit more info please? what exactly is the difference between % and %%? is databricks a separate thing to notebooks? a link to some relevant docs would probably also be helpful, thanks

DetachHead avatar May 16 '25 00:05 DetachHead

Hi there Databricks seems to be a bit exotic here in that it uses %sql fot the whole cell, other implementations just use %%sql. But maybe we can just treat any cell as non-pyhthon cell that starts with %?

https://docs.databricks.com/aws/en/notebooks/notebooks-code#explore-sql-cell-results

aersam avatar May 16 '25 15:05 aersam