Code Monkey home page Code Monkey logo

radb's People

Contributors

junyang avatar onrcn avatar phochmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

radb's Issues

The \help; command produces "token recognition error"

I'm using radb version 3.0.2 with Python 3.7.4 from Anaconda 3, on macOS Mojave 10.14.6.

When I run the \help; command at the ra> prompt, I get what appears to be a parsing error: ERROR: line 1:0 token recognition error at: '\h'. Here is the full context:

$ radb beers.db
WARNING: unable to read configuration file /Users/Foobar/.radb.ini; resorting to system defaults
radb: A relational algebra interpreter over relational databases
Version 3.0.2 by Jun Yang <[email protected]>
https://github.com/junyang/radb
ra> \list;
database relations:
  Bar(name:string, address:string)
  Beer(name:string, brewer:string)
  Drinker(name:string, address:string)
  Frequents(drinker:string, bar:string, times_a_week:number)
  Likes(drinker:string, beer:string)
  Serves(bar:string, beer:string, price:number)
ra> \help;
ERROR: line 1:0 token recognition error at: '\h'
ra> \quit;
$

AttributeError: module 'radb' has no attribute 'ast'

I have the following code:

import radb.parse dd = {} dd["Person"] = {"name": "string", "age": "integer", "gender": "string"} dd["Eats"] = {"name": "string", "pizza": "string"} stmt = """\project_{Person.name, Eats.pizza} \select_{Person.name = Eats.name}(Person \cross Eats);""" ra = radb.parse.one_statement_from_string(stmt) print(ra)

It shows me the following error
Traceback (most recent call last):
File "test.py", line 9, in
ra = one_statement_from_string(stmt)
File "/home/alajeb/.local/lib/python3.6/site-packages/radb/parse.py", line 262, in one_statement_from_string
ast = ASTBuilder().visit(tree)
File "/home/alajeb/.local/lib/python3.6/site-packages/antlr4/tree/Tree.py", line 34, in visit
return tree.accept(self)
File "/home/alajeb/.local/lib/python3.6/site-packages/radb/RAParser.py", line 1745, in accept
return visitor.visitStatement(self)
File "/home/alajeb/.local/lib/python3.6/site-packages/radb/parse.py", line 247, in visitStatement
return self.visit(ctx.getChild(0))
File "/home/alajeb/.local/lib/python3.6/site-packages/antlr4/tree/Tree.py", line 34, in visit
return tree.accept(self)
File "/home/alajeb/.local/lib/python3.6/site-packages/radb/RAParser.py", line 972, in accept
return visitor.visitProjectExpr(self)
File "/home/alajeb/.local/lib/python3.6/site-packages/radb/parse.py", line 175, in visitProjectExpr
return radb.ast.Project(self.visit(ctx.listOfValExprs()), self.visit(ctx.relExpr()))
AttributeError: module 'radb' has no attribute 'ast'

unable to connect to database

After a fresh install of radb, the beers example cannot be started:

[cloudera@quickstart ~]$ /usr/local/bin/python3.6 --version
Python 3.6.5
[cloudera@quickstart ~]$ ls beers.ra
beers.ra
[cloudera@quickstart ~]$ radb -i beers.ra beers.db
WARNING: unable to read configuration file /home/cloudera/.radb.ini; resorting to system defaults
ERROR: failed to connect to database: No module named '_sqlite3'

I thought sqlite3 would have been bundled with radb.

cannot parse "rename" from string

It seems I cannot parse the rename operator from string. The rename-statement to be parsed is a snippet from the documentation.

radb.parse.one_statement_from_string('\rename_{s2} (Serves);')
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/antlr4/Lexer.py", line 128, in nextToken
ttype = self._interp.match(self._input, self._mode)
File "/usr/lib/python3.6/site-packages/antlr4/atn/LexerATNSimulator.py", line 99, in match
return self.execATN(input, dfa.s0)
File "/usr/lib/python3.6/site-packages/antlr4/atn/LexerATNSimulator.py", line 191, in execATN
return self.failOrAccept(self.prevAccept, input, s.configs, t)
File "/usr/lib/python3.6/site-packages/antlr4/atn/LexerATNSimulator.py", line 250, in failOrAccept
raise LexerNoViableAltException(self.recog, input, self.startIndex, reach)
antlr4.error.Errors.LexerNoViableAltException: LexerNoViableAltException('{')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.6/site-packages/radb/parse.py", line 252, in one_statement_from_string
tree = parser.statement()
File "/usr/lib/python3.6/site-packages/radb/RAParser.py", line 1673, in statement
la_ = self._interp.adaptivePredict(self._input,18,self._ctx)
File "/usr/lib/python3.6/site-packages/antlr4/atn/ParserATNSimulator.py", line 342, in adaptivePredict
alt = self.execATN(dfa, s0, input, index, outerContext)
File "/usr/lib/python3.6/site-packages/antlr4/atn/ParserATNSimulator.py", line 465, in execATN
input.consume()
File "/usr/lib/python3.6/site-packages/antlr4/BufferedTokenStream.py", line 99, in consume
if self.sync(self.index + 1):
File "/usr/lib/python3.6/site-packages/antlr4/BufferedTokenStream.py", line 111, in sync
fetched = self.fetch(n)
File "/usr/lib/python3.6/site-packages/antlr4/BufferedTokenStream.py", line 123, in fetch
t = self.tokenSource.nextToken()
File "/usr/lib/python3.6/site-packages/antlr4/Lexer.py", line 130, in nextToken
self.notifyListeners(e) # report error
File "/usr/lib/python3.6/site-packages/antlr4/Lexer.py", line 285, in notifyListeners
listener.syntaxError(self, None, self._tokenStartLine, self._tokenStartColumn, msg, e)
File "/usr/lib/python3.6/site-packages/antlr4/error/ErrorListener.py", line 60, in syntaxError
delegate.syntaxError(recognizer, offendingSymbol, line, column, msg, e)
File "/usr/lib/python3.6/site-packages/radb/parse.py", line 75, in syntaxError
raise ParsingError('line {}:{} {}'.format(line, column, msg))
radb.parse.ParsingError: line 1:7 token recognition error at: '{'

Feature Request: non command line version

We'd love to use radb for our database course at RWTH Aachen i5.
It would be great if it would be possible to interact with radb without a command line so that the integration
with our jupyter notebooks can be improved.

For a start i suggest it would be great to start with a test-first approach and add some python unit tests to the project. This way you could e.g. also automatically test the project with a continuous integration approach.

Dependency problem

SQLAlchemy recently released 2.0.0 which radb doesn't work with. The latest version that works:

SQLAlchemy==1.4.46

Installing radb will install the latest version by default, so you may need to downgrade SQLAlchemy to 1.4.46 after installation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.