Skip to main content

A python native weaviate client

Project description

Weaviate python client Weaviate logo

A python native client for easy interaction with a weaviate instance.

Install

The package can be easily installed using pip. The client is developed and tested for python 3.7.

pip install weaviate-client

Usage

First make sure that weaviate is running. See the installation guide on how to start weaviate.

Before we can load data we need to create a client and load a schema.

import weaviate
client = weaviate.Client("http://localhost:8080")
client.create_schema("https://raw.githubusercontent.com/semi-technologies/weaviate-python-client/master/documentation/getting_started/people_schema.json")

A schema can be provided as an URL, file or a dict. Now lets create some things.

client.create_thing({"name": "John von Neumann"}, "Person", "b36268d4-a6b5-5274-985f-45f13ce0c642")
client.create_thing({"name": "Alan Turing"}, "Person", "1c9cd584-88fe-5010-83d0-017cb3fcb446")

client.create_thing({"name": "Legends"}, "Group", "2db436b5-0557-5016-9c5f-531412adf9c6")

We can simply add cross-references through:

client.add_reference_to_thing("2db436b5-0557-5016-9c5f-531412adf9c6", "members", "b36268d4-a6b5-5274-985f-45f13ce0c642")
client.add_reference_to_thing("2db436b5-0557-5016-9c5f-531412adf9c6", "members", "1c9cd584-88fe-5010-83d0-017cb3fcb446")

Note: Weaviate might needs a second to update its index after a new thing has been created.

Look at the data using the simple query:

{
  Get {
    Things {
      Group {
        name
        uuid
        Members {
          ... on Person {
            name
            uuid
          }
        }
      }
    }
  }
}

Please find the full client documentation here.

Authentication

import weaviate

auth = weaviate.AuthClientPassword("user@example.com", "supersecrettoken")
client = weaviate.Client("http://xcosauwqdjyiwqlb.dev.semi.network", auth)

if client.is_reachable():
    print("Success!")

Build Status

Build Status

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

weaviate_client-0.3.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file weaviate_client-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: weaviate_client-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for weaviate_client-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29ac267f15056a8eb313b5f7b85b64555ab6f9dfae500d609e67c5e2c7c9664c
MD5 5f5de8231ffc89dde3abb1bb5673feff
BLAKE2b-256 5b54c4e0c42830749a8486eb43c1c7585fc7c2b4a1c8d6b311122ee7ccfbea5e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page