package not working for me
felipe0216 opened this issue · 6 comments
Hello,
I have tried to use this packages according to the way showed in the other issues posted as well as the "README" doc, but I keep getting the same error. This is the code that I am trying to run (I have tried several combinations, replacing names to avoid potential keywords as well):
sqlitis 'select * from `abc` join cba'
and I keep getting the same error:
'NoneType' object has no attribute 'render'
PD: Thanks for creating this package, if I make it work it would be incredibly useful, hopefully you guys don't abandon it. If I can be cheeky, do you know by any chance another package/solution that transforms SQL statements into SQLAlchemy statements? (just to compensate for the operations this package doesn't cover)
Thank you!
Hmm, I'm not able to reproduce this myself. Here is what I see,
$ sqlitis 'select * from `abc` join cba'
select([abc.join(cba)])
@felipe0216 Could you please provide the following,
- Your operating system and version
- Your Python version:
python --version
- The output of the following command
sqlitis -d 'select * from `abc` join cba'
Hello @pglass
- Windows 10 Enterprise, version 1809, 64 bit OS.
- Python 3.7.3
DEBUG:sqlitis.convert:to_sqla "'select * from abc
join cba'"
DEBUG:sqlitis.convert:tokens_to_sqla [<1 tokens>]
DEBUG:sqlitis.convert: <Single ''selec...' at 0x26B098BC0A8> <class 'sqlparse.sql.Token'>
DEBUG:sqlitis.convert:0 <class 'module'>
'NoneType' object has no attribute 'render'
Traceback (most recent call last):
File "c:\users\felipe.araya\appdata\local\continuum\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\users\felipe.araya\appdata\local\continuum\anaconda3\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\felipe.araya\AppData\Local\Continuum\anaconda3\Scripts\sqlitis.exe_main.py", line 7, in
File "c:\users\felipe.araya\appdata\local\continuum\anaconda3\lib\site-packages\sqlitis\cli.py", line 26, in main
result = to_sqla(" ".join(args.sql))
File "c:\users\felipe.araya\appdata\local\continuum\anaconda3\lib\site-packages\sqlitis\convert.py", line 43, in wrapped
result = f(*args, **kwargs)
File "c:\users\felipe.araya\appdata\local\continuum\anaconda3\lib\site-packages\sqlitis\convert.py", line 59, in to_sqla
return tokens_to_sqla(tokens).render()
AttributeError: 'NoneType' object has no attribute 'render'
Looking forward to hearing back from you
Thank you. I don't test on Windows since I don't have a Windows machine handy.
However, I was able to reproduce what looks like the same issue on a Windows 10 VM. It appears that command prompt doesn't understand single quotes as string delimiters.
@felipe0216 Please try using double quotes instead of single quotes when passing arguments to sqlitis, like below:
sqlitis "select * from `abc` join cbd"
If you still see an error when using double quotes, please paste the output of sqlitis -d "select * from `abc` join cbd"
Hello @pglass ,
That worked! Thanks man
Hello @pglass,
I have just encountered another problem. If I try to do an INSERT statement using the syntax mentioned, it says the following:
sqlitis "insert into abc values (a,2,3,4)"
Unexpected keyword 'INSERT'. Maybe you need to quote: `INSERT`?
Then, if I try using single quotes for INSERT, it says:
Unexpected keyword 'INTO'. Maybe you need to quote: `INTO`?
And it will carry on like that until you add single quotes to the entire statement, which will looks something like this:
"'insert into' abc 'values' (a,2,3,4)"
( I have tried other combinations like putting one pair of single quotes that cover from start to end, also putting single quotes per word, and a few others, and the message I get is:
not sure how to handle parentheses. treating as subquery!
'Token' object has no attribute 'get_alias'
Any idea how to solve this problem?
Thank you!
PD: If I do the statement only with single quotes (removing the double quotes) I get the same error as the begin of the thread
Yes, so currently only select
statements are supported and even that support is a bit limited. Things like insert, update, and delete are not supported yet.
Please read through the sql support checklist.