-
Notifications
You must be signed in to change notification settings - Fork 1
Description
What
Strip indention from Python source code a la (line endings are marked):
Everything Indented
··CREATE FUNCTION add_one()|
··LANGUAGE python|
··AS '|
··def add_one(x: int) -> int:|
······|
······return x + 1|
··';|
··|
··SELECT add_one(1);|Empty Lines NOT Intended
··CREATE FUNCTION add_one()|
··LANGUAGE python|
··AS '|
··def add_one(x: int) -> int:|
|
······return x + 1|
··';|
|
··SELECT add_one(1);|Python Further Indented
··CREATE FUNCTION add_one()|
··LANGUAGE python|
··AS '|
······def add_one(x: int) -> int:|
··········return x + 1|
······';|
··|
··SELECT add_one(1);|Why
Python will trip over this like:
IndentationError: unexpected indent
Now you may also wonder "why would anyone indent ALL of SQL?" Well, marimo for example does for SQL cells and I'm sure there are others.
How
There are multiple levels where we could fix this:
- The integrating application (i.e. whoever uses this repo)
- The source code extraction (see feat: implement stateless udf registration #97)
- The Python UDF in
guests/python