Exemplo n.º 1
0
def vcollection(request, connect, dim):
    ori_collection_name = getattr(request.module, "collection_id", "test")
    collection_name = gen_unique_str(ori_collection_name)
    collection_param = {
        "fields": [
            {
                "name": Field_Vector,
                "type": DataType.FLOAT_VECTOR,
                "params": {
                    "dim": dim
                }
            },
        ],
        "segment_row_limit":
        100000,
        "auto_id":
        True
    }

    connect.create_collection(collection_name, collection_param)

    def teardown():
        connect.drop_collection(collection_name)

    request.addfinalizer(teardown)

    return collection_name
Exemplo n.º 2
0
def table(request, connect):
    ori_table_name = getattr(request.module, "table_id", "test")
    table_name = gen_unique_str(ori_table_name)
    dim = getattr(request.module, "dim", "128")
    param = {'collection_name': table_name,
             'dimension': dim,
             'index_type': IndexType.IVFLAT,
             'metric_type': MetricType.L2
             }
    connect.create_collection(param)

    def teardown():
        connect.drop_collection(table_name)

    request.addfinalizer(teardown)

    return table_name
Exemplo n.º 3
0
def table(request, connect):
    ori_table_name = getattr(request.module, "table_id", "test")
    table_name = gen_unique_str(ori_table_name)
    dim = getattr(request.module, "dim", "128")
    param = {'table_name': table_name,
             'dimension': dim,
             'index_type': IndexType.IVFLAT,
             'metric_type': MetricType.L2
             }
    connect.create_table(param)

    def teardown():
        status, table_names = connect.show_tables()
        connect.delete_table(table_name)

    request.addfinalizer(teardown)

    return table_name