Issue
I'm trying to make a SQL query that can be used with pandas.read_sql_query.
query = '''SELECT var1, var2, var3, var4,
var5, var6, var7, var8, var9
FROM table
WHERE area='there' '''
This works when running in the console, but when I try to execute this in the Spyder editor I see the following:
SyntaxError: EOF while scanning triple-quoted string literal
Solution
(Spyder maintainer here) The problem is your trying to run your selected code line by line with our Run selection or current line functionality. After running the first line in your code, i.e.
query = '''SELECT var1, var2, var3, var4,
it's clear you'll get
SyntaxError: EOF while scanning triple-quoted string literal
because that line doesn't close the string you started.
Note: Run selection or current line expects a complete Python statement, i.e. something that can be evaluated as it is in Python (e.g. a = 10
).
Answered By - Carlos Cordoba
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.