def query(connection): # Get the physical plan for a test query catalog = MyriaCatalog(connection) servers = catalog.get_num_servers() parser = myrialparser.Parser() processor = interpreter.StatementProcessor(catalog, True) program = """ books = scan(Brandon:Demo:MoreBooks); longerBooks = [from books where pages > 300 emit name]; store(longerBooks, Brandon:Demo:LongerBooks); """ statement_list = parser.parse(program) processor.evaluate(statement_list) pd = processor.get_physical_plan(target_alg=MyriaLeftDeepTreeAlgebra()) json = processor.get_json_from_physical_plan(pd) return {'rawQuery': program, 'logicalRa': 'empty', 'fragments': json}
def setUp(self): # SQLAlchemy self.db = SQLCatalog( sqlalchemy.create_engine('sqlite:///:memory:', echo=True)) self.db.add_table(self.emp_key, self.emp_schema) self.db.add_tuples(self.emp_key, self.emp_schema, self.emp_table) # MyriaL self.parser = parser.Parser() self.processor = interpreter.StatementProcessor(self.db)
from raco.myrial import interpreter as MyrialInterpreter from raco.language import MyriaAlgebra from raco.myrialang import compile_to_json from raco.viz import get_dot from raco.myrial.keywords import get_keywords from raco import scheme from examples import examples, demo3_examples from pagination import Pagination import myria # We need a (global) lock on the Myrial parser because yacc is not Threadsafe. # .. see uwescience/datalogcompiler#39 # .. (https://github.com/uwescience/datalogcompiler/issues/39) myrial_parser_lock = Lock() myrial_parser = MyrialParser.Parser() JINJA_ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader('templates'), extensions=['jinja2.ext.autoescape'], autoescape=True) version_file_path = os.path.join(os.path.dirname(__file__), 'VERSION') branch_file_path = os.path.join(os.path.dirname(__file__), 'BRANCH') try: with open(version_file_path, 'r') as version_file: VERSION = version_file.read().strip() except: VERSION = "commit version file not found"
def setUp(self): self.db = self.create_db() self.parser = parser.Parser() self.new_processor()
def __init__(self, catalog): self.parser = parser.Parser() self.processor = interpreter.StatementProcessor(catalog)