예제 #1
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
예제 #2
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)
예제 #3
0
import os
import numpy as np
import pyarrow as pa
from pyarrow import csv
import 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,
예제 #4
0
import os
import numpy as np
import pyarrow as pa
from pyarrow import csv
import dbe
import ctypes

ctypes._dlopen('libDBEngine.so', ctypes.RTLD_GLOBAL)

d = dbe.PyDbEngine(data='data', calcite_port=9091)
assert not d.closed
root = os.path.dirname(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
table = csv.read_csv(root + "/Tests/Import/datafiles/santander_top1000.csv")
assert table
d.consumeArrowTable("santander", table)
assert not d.closed
print("last step")
r = d.executeDML("select target from santander")
assert r
예제 #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