How does one create a tenant?

here you say:

mt_collection.tenants.create("steve85")

without qualification but here you say:

multi_collection.tenants.create(
    tenants=[
        Tenant(name="tenantA"),
        Tenant(name="tenantB"),
    ]
)

for python client v4???

So which is it?

hi @alexander !!

Welcome to our community :hugs:

The collection.tenants.create method requires only the parameter tenants, where you should pass a single string or Tenant object, or a list of strings and Tenant objects.

All of them will have the same outcome. For example:

from weaviate import classes as wvc

assert len(collection.tenants.get()) == 0

collection.tenants.create("Tenant1")
collection.tenants.create(tenants=["Tenant2", "Tenat3"])
collection.tenants.create(
    [
        wvc.tenants.Tenant(name="Tenant4"),
        "Tenant5"
    ]
)
assert len(collection.tenants.get()) == 5

The only “difference” here is that by using Tenant() you can specify the activity_status along with the name.

Note that since Weaviate 1.25 we implemented auto tenant creation and activation

With that option on, if you specify a non existent or inactive tenant while ingesting, Weaviate will create/activate that tenant for you on the fly.

Let me know if that helps!

Thanks!

thanks mate, good to know. I guess the inconsistency in the docs is a little confusing.

1 Like

We have raised this to our team so we can improve it.

Thanks for reporting. We really appreciate it!