Пример #1
0
def test_init():
    global engine
    engine = dbe.PyDbEngine(
        enable_fsi=1,
        calcite_port=9091,
    )
    assert bool(engine.closed) == False
Пример #2
0
def test_init():
    global engine
    engine = dbe.PyDbEngine(
        enable_union=1,
        enable_columnar_output=1,
        enable_lazy_fetch=0,
        null_div_by_zero=1,
    )
    assert bool(engine.closed) == False
Пример #3
0
def test_failed_init():
    global engine
    try:
        shutil.rmtree(data_path)
    except FileNotFoundError:
        pass

    with pytest.raises(RuntimeError) as excinfo:
        engine = dbe.PyDbEngine(data='/' + data_path, calcite_port=9091)
    assert "Permission denied" in str(excinfo.value)
Пример #4
0
import os
import numpy as np
import pyarrow as pa
from pyarrow import csv
import omniscidbe as dbe
import ctypes
ctypes._dlopen('libDBEngine.so', ctypes.RTLD_GLOBAL)

d = dbe.PyDbEngine(enable_fsi=1, data='data', calcite_port=9091)
assert not d.closed

root = os.path.dirname(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
csv_file = root + "/Tests/Import/datafiles/trips_with_headers_top1000.csv"

print("DDL")
r = d.executeDDL("""
CREATE TEMPORARY TABLE trips (
trip_id BIGINT,
vendor_id TEXT ENCODING NONE,
pickup_datetime TIMESTAMP,
dropoff_datetime TIMESTAMP,
store_and_fwd_flag TEXT ENCODING DICT,
rate_code_id BIGINT,
pickup_longitude DOUBLE,
pickup_latitude DOUBLE,
dropoff_longitude DOUBLE,
dropoff_latitude DOUBLE,
passenger_count BIGINT,
trip_distance DOUBLE,
fare_amount DOUBLE,
Пример #5
0
def test_double_init():
    with pytest.raises(RuntimeError) as excinfo:
        engine = dbe.PyDbEngine()
    assert "already initialized" in str(excinfo.value)
Пример #6
0
def test_success_init():
    global engine
    engine = dbe.PyDbEngine(data=data_path, calcite_port=9091)
    assert bool(engine.closed) == False