question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Assignment operator << for multiline sql statements not working

See original GitHub issue

If 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:open
  • Created 7 years ago
  • Reactions:2
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
younglee23commented, Apr 26, 2017

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!

1reaction
esegalcommented, Jul 17, 2017

I’ve installed v0.3.9 and I still get this error. Thanks!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found