예제 #1
0
파일: test_hdf5.py 프로젝트: zdog234/ibis
def test_insert(transformed, tmpdir):

    t = transformed
    expected = execute(t)

    tpath = tmpdir / 'new_dir'
    tpath.mkdir()
    path = tpath / 'foo.h5'

    assert not path.exists()
    t = transformed[['time', 'ticker', 'avg']]
    c = ibis.hdf5.connect(tpath)
    c.insert('foo.h5', 'avg', t)
    execute(t)
    assert path.exists()

    # readback
    c = HDFClient(str(tpath)).database()
    result = c.list_databases()
    assert result == ['foo']

    result = c.foo.avg.execute()
    tm.assert_frame_equal(result, expected)
    path = tpath / 'foo.h5'
    assert path.exists()
예제 #2
0
파일: test_hdf5.py 프로젝트: cloudera/ibis
def test_insert(transformed, tmpdir):

    t = transformed
    expected = execute(t)

    tpath = tmpdir / 'new_dir'
    tpath.mkdir()
    path = tpath / 'foo.h5'

    assert not path.exists()
    t = transformed[['time', 'ticker', 'avg']]
    c = ibis.hdf5.connect(tpath)
    c.insert('foo.h5', 'avg', t)
    execute(t)
    assert path.exists()

    # readback
    c = HDFClient(str(tpath)).database()
    result = c.list_databases()
    assert result == ['foo']

    result = c.foo.avg.execute()
    tm.assert_frame_equal(result, expected)
    path = tpath / 'foo.h5'
    assert path.exists()
예제 #3
0
def hdf(tmpdir, data):
    from ibis.file.hdf5 import HDFClient

    hdf = tmpdir.mkdir('hdf_dir')
    f = hdf / 'prices.h5'

    for k, v in data.items():
        v.to_hdf(str(f), k, format='table', data_columns=True)

    return HDFClient(tmpdir).database()
예제 #4
0
파일: test_hdf5.py 프로젝트: zdog234/ibis
def test_client(tmpdir, data):

    # construct with a path to a file
    hdf = tmpdir
    f = hdf / 'prices.h5'

    for k, v in data.items():
        v.to_hdf(str(f), k, format='table', data_columns=True)

    c = HDFClient(tmpdir)
    assert c.list_databases() == ['prices']
    assert c.database().prices.list_tables() == ['close', 'open']

    c = HDFClient(tmpdir / 'prices.h5')
    assert c.list_databases() == []
    assert c.list_tables() == ['close', 'open']
예제 #5
0
파일: test_hdf5.py 프로젝트: cloudera/ibis
def test_client(tmpdir, data):

    # construct with a path to a file
    hdf = tmpdir
    f = hdf / 'prices.h5'

    for k, v in data.items():
        v.to_hdf(str(f), k, format='table', data_columns=True)

    c = HDFClient(tmpdir)
    assert c.list_databases() == ['prices']
    assert c.database().prices.list_tables() == ['close', 'open']

    c = HDFClient(tmpdir / 'prices.h5')
    assert c.list_databases() == []
    assert c.list_tables() == ['close', 'open']