milvus-logo
Star
0
Forks
0
Get Started

Schema

CollectionSchema and FieldSchema.

Constructor

Constructor

Description

CollectionSchema()

Schema of collection.

FieldSchema()

Schema of field.

CollectionSchema Attributes

API

Description

fields

Return the fields of collection.

description

Return the description text about the collection.

primary_field()

Return the primary key column of collection.

auto_id()

Return whether the ids is automatically generated.

APIs

class pymilvus.CollectionSchema(fields, description='', **kwargs)
property fields

Returns the fields about the CollectionSchema.

Return list

List of FieldSchema, return when operation is successful.

Example
>>> from pymilvus import FieldSchema, CollectionSchema, DataType
>>> field = FieldSchema("int64", DataType.INT64, description="int64", is_primary=True)
>>> schema = CollectionSchema(fields=[field])
>>> schema.fields
[]
property description

Returns a text description of the CollectionSchema.

Return str

CollectionSchema description text, return when operation is successful.

Example
>>> from pymilvus import FieldSchema, CollectionSchema, DataType
>>> field = FieldSchema("int64", DataType.INT64, description="int64", is_primary=True)
>>> schema = CollectionSchema(fields=[field], description="test get description")
>>> schema.description
'test get description'
property auto_id

Whether the primary keys are automatically generated.

Return bool
  • True: If the primary keys are automatically generated,

  • False: Otherwise.

Example
>>> from pymilvus import FieldSchema, CollectionSchema, DataType
>>> field = FieldSchema("int64", DataType.INT64, description="int64", is_primary=True)
>>> schema = CollectionSchema(fields=[field])
>>> schema.auto_id
False

FieldSchema Attributes

API

Description

name

Return the name of field.

is_primary

Return whether the field is primary key column.

APIs

class pymilvus.FieldSchema(name, dtype, description='', **kwargs)