コード例 #1
0
def conn():
    engine = sqlalchemy.create_engine("sqlite://")
    create_insert(engine)
    executor = MdxEngine(sqla_engine=engine, source_type="db")
    executor.load_cube(cube_name="main", fact_table_name="facts")
    discover_request_hanlder = XmlaDiscoverReqHandler(executor)
    execute_request_hanlder = XmlaExecuteReqHandler(executor)

    print("spawning server")
    application = Application(
        [XmlaProviderService],
        "urn:schemas-microsoft-com:xml-analysis",
        in_protocol=Soap11(validator="soft"),
        out_protocol=Soap11(validator="soft"),
        config={
            "discover_request_hanlder": discover_request_hanlder,
            "execute_request_hanlder": execute_request_hanlder,
        },
    )

    wsgi_application = WsgiApplication(application)
    server = WSGIServer(application=wsgi_application, host=HOST, port=PORT)

    server.start()

    provider = xmla.XMLAProvider()
    yield provider.connect(location=server.url)

    print("stopping server")
    drop_tables(engine)
    server.stop()
コード例 #2
0
def benchmark():
    mdx_executor = MdxEngine(cubes_folder="cubes_templates",
                             olapy_data_location="../../../olapy")
    mdx_executor.load_cube(BENCH_CUBE)
    xmla_discover_request_handler = XmlaDiscoverReqHandler(mdx_executor)
    xmla_execute_request_handler = XmlaExecuteReqHandler(mdx_executor)

    return run_benchmark(mdx_executor, xmla_discover_request_handler,
                         xmla_execute_request_handler)