DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Allow Users to Track Fitness Status in Your App
  • User-Friendly API Publishing and Testing With Retrofit
  • The Complete Guide to Stream API and Collectors in Java 8
  • Graph API for Entra ID (Azure AD) Object Management

Trending

  • The Human Side of Logs: What Unstructured Data Is Trying to Tell You
  • Hybrid Cloud vs Multi-Cloud: Choosing the Right Strategy for AI Scalability and Security
  • Apache Doris vs Elasticsearch: An In-Depth Comparative Analysis
  • The Cypress Edge: Next-Level Testing Strategies for React Developers
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. An Introduction to Milvus Python SDK and API

An Introduction to Milvus Python SDK and API

Learn how SDKs interact with Milvus and why ORM-style API helps you better manage Milvus.

By 
Xuan Yang user avatar
Xuan Yang
·
May. 09, 22 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
2.7K Views

Join the DZone community and get the full member experience.

Join For Free

Cover image.

Background

The following illustration depicts the interaction between SDKs and Milvus through gRPC. Imagine that Milvus is a black box. Protocol Buffers are used to define the interfaces of the server and the structure of the information they carry. Therefore, all operations in the black box Milvus are defined by Protocol API.

The interaction between SDKs and Milvus through gRPC

The interaction between SDKs and Milvus through gRPC

Milvus Protocol API

Milvus Protocol API consists of milvus.proto, common.proto, and schema.proto, which are Protocol Buffers files suffixed with .proto. SDKs must interact with Milvus with these Protocol Buffers files to ensure proper operation.

milvus.proto

milvus.proto is the vital component of Milvus Protocol API because it defines the, which further defines all RPC interfaces of Milvus.

The following code sample shows the interface CreatePartitionRequest. It has two major string-type parameters collection_name and partition_name, based on which you can start a partition creation request.

CreatePartitionRequest interface

CreatePartitionRequest interface

Check an example of Protocol in PyMilvus GitHub Repository on line 19.

An example of Protocol

An example of a Protocol

You can find the definition  CreatePartitionRequest here.

The definition of CreatePartitionRequest

The definition of CreatePartitionRequest

Contributors who wish to develop a feature of Milvus or an SDK in a different programming language are welcome to find all interfaces Milvus offers via RPC.

common.proto

common.proto defines the common types of information, including, and Status.

common.proto

common.proto

schema.proto

schema.proto defines the schema in the parameters. The following code sample is an example of CollectionSchema.

schema.proto

schema.proto

milvus.proto, common.proto, and schema.proto together constitutes the API of Milvus, representing all operations that can be called via RPC.

If you dig into the source code and observe, you will find that when interfaces like create_index are called, they call multiple RPC interfaces such as describe_collection and describe_index. Many of the outward interfaces of Milvus is a combination of multiple RPC interfaces.

Having understood the behaviors of RPC, you can then develop new features for Milvus through combination. You are more than welcome to use your imagination and creativeness and contribute to the Milvus community.

PyMilvus 2.0

Object-Relational Mapping (ORM)

To put it in a nutshell, Object-relational mapping (ORM) refers to that when you operate on a local object; such operations will affect the corresponding object on the server. PyMilvus ORM-style API features the following characteristics:

  1. First, it operates directly on objects.
  2. It isolates service logic and data access details.
  3. It hides the complexity of implementation, and you can run the same scripts across different Milvus instances regardless of their deployment approaches or implementation.

ORM-Style API

One of the essences of ORM-style API lies in the control of the Milvus connection. For example, you can specify aliases for multiple Milvus servers and connect to or disconnect from them merely with their aliases. You can even delete the local server address and precisely control certain objects via a specific connection.

Control connections to Milvus

Control connections to Milvus

Another feature of ORM-style API is that, after abstraction, all operations can be performed directly on objects, including collection, partition, and index.

You can abstract a collection object by getting an existing one or creating a new one. You can also assign a Milvus connection to specific objects using a connection alias so that you can operate on these objects locally.

To create a partition object, you can either create it with its parent collection object or do it just like when you create a collection object. These methods can be employed on an index object as well.

In the case that these partition or index objects exist, you can get them through their parent collection object.

What's More

It is recommended to learn about PyMilvus through our technical document. The document consists of two major sections, including an automated API reference and usage instructions made by our contributors.

  • Milvus Technical Document
  • PyMilvus Source Document
API Protocol Buffers Software development kit Interface (computing) Object (computer science) Protocol (object-oriented programming) Python (language)

Published at DZone with permission of Xuan Yang. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Allow Users to Track Fitness Status in Your App
  • User-Friendly API Publishing and Testing With Retrofit
  • The Complete Guide to Stream API and Collectors in Java 8
  • Graph API for Entra ID (Azure AD) Object Management

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!