catherinedevlin/ipython-sql

%sql fails when query contains a Negative number

feverittm opened this issue · 2 comments

When running a valid sql comment that has a negative integer as an argument:

%sql SELECT DATEADD(month, -2, SYSDATE)

It returns an error:

UsageError: unrecognized arguments: -2, SYSDATE)

If you make the '-2' a string and cast it to an INT then it works:

%sql SELECT DATEADD(month, '-2'::INT, SYSDATE)

Works.

have the same issue

Another workaround is to remove the space before the '-': %sql SELECT DATEADD(month,-2, SYSDATE)