ipython-sql icon indicating copy to clipboard operation
ipython-sql copied to clipboard

ipython-sql new version ValueError: No closing quotation

Open fawolfmann opened this issue 5 years ago • 1 comments

I installed the new version of ipython-sql

with

git clone https://github.com/catherinedevlin/ipython-sql.git
pip install ipython-sql

This is the code I made a simple select in a string and run with %sql magic card with the older version works, this new version doesn't.

```
selections = """SELECT XXX.name, YYY.name from XXX 
join YYY on XXX.id = YYY.xid"""

selectcics = selections.replace('\n', ' ')
cics = %sql $selections
This the error:

    ```
~/anaconda3/lib/python3.7/site-packages/IPython/utils/_process_common.py in arg_split(s, posix, strict)
        200     while True:
        201         try:
    --> 202             tokens.append(next(lex))
        203         except StopIteration:
        204             break
    
    ~/anaconda3/lib/python3.7/shlex.py in __next__(self)
        297 
        298     def __next__(self):
    --> 299         token = self.get_token()
        300         if token == self.eof:
        301             raise StopIteration
    
    ~/anaconda3/lib/python3.7/shlex.py in get_token(self)
        107             return tok
        108         # No pushback.  Get a token.
    --> 109         raw = self.read_token()
        110         # Handle inclusions
        111         if self.source is not None:
    
    ~/anaconda3/lib/python3.7/shlex.py in read_token(self)
        189                         print("shlex: I see EOF in quotes state")
        190                     # XXX what error should be raised here?
    --> 191                     raise ValueError("No closing quotation")
        192                 if nextchar == self.state:
        193                     if not self.posix:
    
    ValueError: No closing quotation

Any help will be appreciated

fawolfmann avatar Mar 14 '20 20:03 fawolfmann

try using

...
selectcics = selections.replace('\n', ' ')
cics = %sql {selections}

DSLituiev avatar Apr 09 '20 22:04 DSLituiev