Giter Site home page Giter Site logo

Comments (5)

SimFG avatar SimFG commented on August 12, 2024

@juanandreas I checked and there should be an error in usage. You can refer to the following example:

import time
import numpy as np
from pymilvus import (
    MilvusClient,
    DataType
)

fmt = "\n=== {:30} ===\n"
dim = 8
collection_name = "hello_milvus10"
milvus_client = MilvusClient("http://localhost:19530")

has_collection = milvus_client.has_collection(collection_name, timeout=5)
if has_collection:
    milvus_client.drop_collection(collection_name)

schema = milvus_client.create_schema(enable_dynamic_field=True, partition_key_field="num")
schema.add_field("id", DataType.INT64, is_primary=True)
schema.add_field("embeddings", DataType.FLOAT_VECTOR, dim=dim)
schema.add_field("title", DataType.VARCHAR, max_length=64)
schema.add_field("num", DataType.INT64)

index_params = milvus_client.prepare_index_params()
index_params.add_index(field_name = "embeddings", metric_type="L2")
milvus_client.create_collection(collection_name, schema=schema, index_params=index_params, consistency_level="Strong", num_partitions=16)

print(fmt.format("    all collections    "))
print(milvus_client.list_collections())
print(milvus_client.list_partitions(collection_name=collection_name))

output:
image

from pymilvus.

juanandreas avatar juanandreas commented on August 12, 2024

Thank you! I think the documentation should clarify that num_partitions argument should be defined at client.create_collection(), not client.create_schema().

Can you share how to write into this collection using do_bulk_insert? This may be a related bug.

I am currently experiencing:

milvus.do_bulk_insert(collection_name=COLLECTION, files=list_of_files, partition_name=partition_name)

RPC error: [do_bulk_insert], <MilvusException: (code=2100, message=not allow to set partition name for collection with partition key: importing data failed)>

if I exclude the partition_name,

milvus.do_bulk_insert(collection_name=COLLECTION, files=list_of_files)

TypeError: do_bulk_insert() missing 1 required positional argument: 'partition_name'

This seems contradictory.

from pymilvus.

SimFG avatar SimFG commented on August 12, 2024

Which package is milvus used here? Is it pymilvus.utility? in milvus.do_bulk_insert

from pymilvus.

juanandreas avatar juanandreas commented on August 12, 2024

Which package is milvus used here? Is it pymilvus.utility? in milvus.do_bulk_insert

import pymilvus

milvus = pymilvus.Milvus(host=MILVUS_HOST, port=MILVUS_PORT)
milvus.do_bulk_insert(collection_name=COLLECTION, files=list_of_files, partition_name=partition_name)

I am running 2.4.3 of pymilvus and milvus version 2.4.3

from pymilvus.

XuanYang-cn avatar XuanYang-cn commented on August 12, 2024

/assign

from pymilvus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.