Use the new API
This commit is contained in:
parent
be9fdd2e84
commit
87ec732d24
@ -57,7 +57,7 @@ def load_relations():
|
|||||||
|
|
||||||
print ("Loading relation %s with name %s..." % (i, relname))
|
print ("Loading relation %s with name %s..." % (i, relname))
|
||||||
|
|
||||||
rels[relname] = relation.Relation('%s%s' % (examples_path, i))
|
rels[relname] = relation.Relation.load('%s%s' % (examples_path, i))
|
||||||
print('done')
|
print('done')
|
||||||
|
|
||||||
|
|
||||||
@ -163,7 +163,8 @@ def run_py_test(testname):
|
|||||||
'''Runs a python test, which evaluates expressions directly rather than queries'''
|
'''Runs a python test, which evaluates expressions directly rather than queries'''
|
||||||
print ("Running expression python test: " +
|
print ("Running expression python test: " +
|
||||||
colorize(testname, COLOR_MAGENTA))
|
colorize(testname, COLOR_MAGENTA))
|
||||||
|
exp_result = None
|
||||||
|
result = None
|
||||||
try:
|
try:
|
||||||
|
|
||||||
expr = readfile('%s%s.python' % (tests_path, testname))
|
expr = readfile('%s%s.python' % (tests_path, testname))
|
||||||
@ -238,7 +239,7 @@ def run_test(testname):
|
|||||||
o_result = None
|
o_result = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result_rel = relation.Relation('%s%s.result' % (tests_path, testname))
|
result_rel = relation.Relation.load('%s%s.result' % (tests_path, testname))
|
||||||
|
|
||||||
query = readfile('%s%s.query' % (tests_path, testname)).strip()
|
query = readfile('%s%s.query' % (tests_path, testname)).strip()
|
||||||
o_query = optimizer.optimize_all(query, rels)
|
o_query = optimizer.optimize_all(query, rels)
|
||||||
|
@ -91,7 +91,7 @@ class UserInterface:
|
|||||||
def load(self, filename: str, name: str) -> None:
|
def load(self, filename: str, name: str) -> None:
|
||||||
'''Loads a relation from file, and gives it a name to
|
'''Loads a relation from file, and gives it a name to
|
||||||
be used in subsequent queries.'''
|
be used in subsequent queries.'''
|
||||||
rel = Relation(filename)
|
rel = Relation.load(filename)
|
||||||
self.set_relation(name, rel)
|
self.set_relation(name, rel)
|
||||||
|
|
||||||
def unload(self, name: str) -> None:
|
def unload(self, name: str) -> None:
|
||||||
@ -204,7 +204,7 @@ class UserInterface:
|
|||||||
[varname =] query
|
[varname =] query
|
||||||
to assign the result to a new relation
|
to assign the result to a new relation
|
||||||
'''
|
'''
|
||||||
r = Relation()
|
r = None
|
||||||
queries = query.split('\n')
|
queries = query.split('\n')
|
||||||
for query in queries:
|
for query in queries:
|
||||||
if query.strip() == '':
|
if query.strip() == '':
|
||||||
@ -219,4 +219,6 @@ class UserInterface:
|
|||||||
query,
|
query,
|
||||||
str(e)
|
str(e)
|
||||||
))
|
))
|
||||||
|
if r is None:
|
||||||
|
raise Exception('No query executed')
|
||||||
return r
|
return r
|
||||||
|
Loading…
x
Reference in New Issue
Block a user