Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser error when using dbConnect #8

Closed
nsh87 opened this issue Jul 8, 2015 · 3 comments
Closed

Parser error when using dbConnect #8

nsh87 opened this issue Jul 8, 2015 · 3 comments
Assignees

Comments

@nsh87
Copy link

nsh87 commented Jul 8, 2015

Thanks for this very useful package, first of all. I can only assume this is a parser error based on the traceback, if it is not sorry.

[127.0.0.1:2200] out: >>> c.eval("packageVersion('RSQLite')")
[127.0.0.1:2200] out: [array([1, 0, 0], dtype=int32)]
# Connect to a DB, or create it in the wd() if it doesn't exist
[127.0.0.1:2200] out: >>> c.eval("con <- dbConnect(RSQLite::SQLite(), dbname='testdb')")
[127.0.0.1:2200] out: Traceback (most recent call last):
[127.0.0.1:2200] out:   File "<console>", line 1, in <module>
[127.0.0.1:2200] out:   File "/server/env.example.com/local/lib/python2.7/site-packages/pyRserve/rconn.py", line 76, in decoCheckIfClosed
[127.0.0.1:2200] out:     return func(self, *args, **kw)
[127.0.0.1:2200] out:   File "/server/env.example.com/local/lib/python2.7/site-packages/pyRserve/rconn.py", line 159, in eval
[127.0.0.1:2200] out:     message = rparse(src, atomicArray=atomicArray)
[127.0.0.1:2200] out:   File "/server/env.example.com/local/lib/python2.7/site-packages/pyRserve/rparser.py", line 606, in rparse
[127.0.0.1:2200] out:     return rparser.parse()
[127.0.0.1:2200] out:   File "/server/env.example.com/local/lib/python2.7/site-packages/pyRserve/rparser.py", line 414, in parse
[127.0.0.1:2200] out:     message = self._parse()
[127.0.0.1:2200] out:   File "/server/env.example.com/local/lib/python2.7/site-packages/pyRserve/rparser.py", line 441, in _parse
[127.0.0.1:2200] out:     expression = self._parseExpr()
[127.0.0.1:2200] out:   File "/server/env.example.com/local/lib/python2.7/site-packages/pyRserve/rparser.py", line 448, in _parseExpr
[127.0.0.1:2200] out:     lexeme = self.lexer.nextExprHdr()
[127.0.0.1:2200] out:   File "/server/env.example.com/local/lib/python2.7/site-packages/pyRserve/rparser.py", line 265, in nextExprHdr
[127.0.0.1:2200] out:     (hex(rTypeCode), startLexpos, length))
[127.0.0.1:2200] out: RParserError: Unknown SEXP type 0x7 found at lexpos 20, length 180
# The connection and the DB is made, despite the warnings
[127.0.0.1:2200] out: >>> c.eval('class(con)')
[127.0.0.1:2200] out: AttrArray(['SQLiteConnection'],
[127.0.0.1:2200] out:       dtype='|S16', attr={'package': array(['RSQLite'],
[127.0.0.1:2200] out:       dtype='|S7')})

Just for reference, the same thing in R would be:

> con <- dbConnect(RSQLite::SQLite(), dbname='testdb')
> con
<SQLiteConnection>
> class(con)
[1] "SQLiteConnection"
attr(,"package")
[1] "RSQLite"

I could imagine a parser error on <SQLiteConnection>, but note that there is no output from the command generating the error, con <- dbConnect(RSQLite::SQLite(), dbname='testdb').

@ralhei
Copy link
Owner

ralhei commented Jul 9, 2015

Thanks for the report. Indeed I had never come across db connection objects in R so far, so that's probably why there is this implementation issue. Hope I can fix this by the end of this week.

@ralhei ralhei self-assigned this Jul 9, 2015
@ralhei
Copy link
Owner

ralhei commented Jul 11, 2015

Hi Nikhil, I've uploaded a new version (0.8.2) to pypi, this should fix your problem.

@nsh87
Copy link
Author

nsh87 commented Jul 13, 2015

Works perfectly now. I like the output showing the dbname of the connection. Thanks! My output is a bit wonky because I'm operating over Fabric, but essentially:

[127.0.0.1:2200] out: >>> con.eval("c <- dbConnect(RSQLite::SQLite(), dbname='testdb')")
[127.0.0.1:2200] out: <S4 attrs=[('Id', 22), ('dbname', array(['testdb'],
[127.0.0.1:2200] out: dtype='|S59')), ('loadable.extensions', array([ True], dtype=bool)), ('flags', array([6], dtype=int32)), ('vfs', array([''],
[127.0.0.1:2200] out: dtype='|S1')), ('class', AttrArray(['SQLiteConnection'],
[127.0.0.1:2200] out: dtype='|S16', attr={'package': array(['RSQLite'],
[127.0.0.1:2200] out: dtype='|S7')}))]>

@nsh87 nsh87 closed this as completed Jul 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants