Assignment operator << for multiline sql statements not working
See original GitHub issueIf I understand the documentation correctly in order for me to store the query output to the variable “works” I can use “<<” as done below:
%%sql works << select top 10 itemid from tblitemdata
But this results in an error message (pyodbc.ProgrammingError) (‘42000’, “[42000] [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near ‘<’. (102) (SQLExecDirectW)”) [SQL: u’works <<\nselect top 10 itemid\nfrom tblitemdata’]
Single line queries seem to get assigned fine i.e.
works = %sql select top 10 itemid from tblitemdata
returns “Done”.
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Single statement across multiple lines in VB.NET without the ...
No, you have to use the underscore, but I believe that VB.NET 10 will allow multiple lines w/o the underscore, only requiring if...
Read more >Using the SQL Shell Interface - InterSystems Documentation
Describes how to write and execute SQL statements from the InterSystems Terminal using a shell interface.
Read more >Documentation: 15: 43.5. Basic Statements - PostgreSQL
An assignment of a value to a PL/pgSQL variable is written as: ... In general, any SQL command that does not return rows...
Read more >12.8 String Functions and Operators - MySQL :: Developer Zone
QUOTE(), Escape the argument for use in an SQL statement ... This function does not work properly if the first argument contains a...
Read more >JavaScript Strings - W3Schools
The solution to avoid this problem, is to use the backslash escape character. The backslash ( \ ) escape character turns special characters...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi Databoy555,
I had the same issue and I think I solved it. The code for this feature is in v0.3.9 which released fairly recently. Unfortunately, updating the package from python or anaconda only updates you to v0.3.8. If you don’t want to wait for the release to your preferred package source, you may clone/install directly from the git repository.
Hope this helps!
I’ve installed v0.3.9 and I still get this error. Thanks!