ipython-sql
ipython-sql copied to clipboard
%sql fails when query contains a Negative number
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)