0Pricing
Vector Databases: Pinecone, Weaviate & pgvector · Lesson

Importing Data Objects

Learn to efficiently import and manage data objects into your Weaviate instance, including their associated vectors.

Importing Data to Weaviate

Welcome! In this lesson, you'll learn how to get your valuable data into your Weaviate instance. This is a crucial step for performing semantic searches and leveraging Weaviate's powerful capabilities.

We'll cover how to add individual data objects and, more importantly, how to efficiently import large datasets using batch operations, including handling custom vectors.

Setting Up the Weaviate Client

Before you can import data, you need to establish a connection to your Weaviate instance using its Python client. This client acts as your primary interface for interacting with the database.

Run the code below to see how to connect to a local Weaviate instance.

import weaviate

def main():
  # Connect to a local Weaviate instance
  # For a cloud instance, you'd use weaviate.connect_to_wcs(...)
  client = weaviate.connect_to_local()
  
  if client.is_connected():
    print("Weaviate client connected successfully!")
  else:
    print("Failed to connect to Weaviate.")
  
  client.close() # Always close the connection

if __name__ == "__main__":
  main()

All lessons in this course

  1. Weaviate Schema Definition
  2. Importing Data Objects
  3. Weaviate GraphQL Queries
  4. Vectorizer Modules and Auto-Embedding
← Back to Vector Databases: Pinecone, Weaviate & pgvector