@@ -77,7 +77,7 @@ To reduce the complexity in data inserts, Milvus allows you to specify a default
77
77
Create a regular field schema:
78
78
79
79
``` python
80
- from pymilvus import FieldSchema
80
+ from pymilvus import DataType, FieldSchema
81
81
id_field = FieldSchema(name = " id" , dtype = DataType.INT64 , is_primary = True , description = " primary id" )
82
82
age_field = FieldSchema(name = " age" , dtype = DataType.INT64 , description = " age" )
83
83
embedding_field = FieldSchema(name = " embedding" , dtype = DataType.FLOAT_VECTOR , dim = 128 , description = " vector" )
@@ -89,7 +89,7 @@ position_field = FieldSchema(name="position", dtype=DataType.VARCHAR, max_length
89
89
Create a field schema with default field values:
90
90
91
91
``` python
92
- from pymilvus import FieldSchema
92
+ from pymilvus import DataType, FieldSchema
93
93
94
94
fields = [
95
95
FieldSchema(name = " id" , dtype = DataType.INT64 , is_primary = True ),
@@ -174,7 +174,7 @@ A collection schema is the logical definition of a collection. Usually you need
174
174
</div >
175
175
176
176
``` python
177
- from pymilvus import FieldSchema, CollectionSchema
177
+ from pymilvus import DataType, FieldSchema, CollectionSchema
178
178
id_field = FieldSchema(name = " id" , dtype = DataType.INT64 , is_primary = True , description = " primary id" )
179
179
age_field = FieldSchema(name = " age" , dtype = DataType.INT64 , description = " age" )
180
180
embedding_field = FieldSchema(name = " embedding" , dtype = DataType.FLOAT_VECTOR , dim = 128 , description = " vector" )
@@ -189,7 +189,7 @@ schema = CollectionSchema(fields=[id_field, age_field, embedding_field], auto_id
189
189
Create a collection with the schema specified:
190
190
191
191
``` python
192
- from pymilvus import Collection,connections
192
+ from pymilvus import Collection, connections
193
193
conn = connections.connect(host = " 127.0.0.1" , port = 19530 )
194
194
collection_name1 = " tutorial_1"
195
195
collection1 = Collection(name = collection_name1, schema = schema, using = ' default' , shards_num = 2 )
@@ -207,6 +207,7 @@ collection1 = Collection(name=collection_name1, schema=schema, using='default',
207
207
You can also create a collection with <code >Collection.construct_from_dataframe</code >, which automatically generates a collection schema from DataFrame and creates a collection.
208
208
209
209
``` python
210
+ from pymilvus import Collection
210
211
import pandas as pd
211
212
df = pd.DataFrame({
212
213
" id" : [i for i in range (nb)],
0 commit comments