class_docstr: Interact with Weaviate database to store vectors. This hook uses the 'conn_id'.
  
  :param conn_id: The connection id to use when connecting to Weaviate. <howto/connection:weaviate>
class_docstr_tok: ["Interact","with","Weaviate","database","to","store","vectors",".","This","hook","uses","the","'conn_id","'",".",":","param","conn_id",":","The","connection","id","to","use","when","connecting","to","Weaviate",".","<","howto\/connection",":","weaviate",">"]
docstr: Create or replace the classes in schema of Weaviate database.
  
  :param schema_json: Json containing the schema. Format {"class_name": "class_dict"}
      .. seealso:: `example of class_dict <https://weaviate-python-client.readthedocs.io/en/v3.25.2/weaviate.schema.html#weaviate.schema.Schema.create>`_.
  :param existing: Options to handle the case when the classes exist, possible options
      'replace', 'fail', 'ignore'.
code: def create_or_replace_classes(
      self,
      schema_json: dict[str, Any] | str,
      existing: ExitingSchemaOptions = "ignore",
  ):
      """
      Create or replace the classes in schema of Weaviate database.
  
      :param schema_json: Json containing the schema. Format {"class_name": "class_dict"}
          .. seealso:: `example of class_dict <https://weaviate-python-client.readthedocs.io/en/v3.25.2/weaviate.schema.html#weaviate.schema.Schema.create>`_.
      :param existing: Options to handle the case when the classes exist, possible options
          'replace', 'fail', 'ignore'.
      """
      existing_schema_options = ["replace", "fail", "ignore"]
      if existing not in existing_schema_options:
          raise ValueError(
              f"Param 'existing' should be one of the {existing_schema_options} values."
          )
      if isinstance(schema_json, str):
          schema_json = cast(dict, json.load(open(schema_json)))
      set__exiting_classes = {
          class_object["class"]
          for class_object in self.get_schema()["classes"]
      }
      set__to_be_added_classes = {key for key, _ in schema_json.items()}
      intersection_classes = set__exiting_classes.intersection(
          set__to_be_added_classes
      )
      classes_to_create = set()
      if existing == "fail" and intersection_classes:
          raise ValueError(
              f"Trying to create class {intersection_classes} but this class already exists."
          )
      elif existing == "ignore":
          classes_to_create = (
              set__to_be_added_classes - set__exiting_classes
          )
      elif existing == "replace":
          error_list = self.delete_classes(
              class_names=list(intersection_classes)
          )
          if error_list:
              raise ValueError(error_list)
          classes_to_create = intersection_classes.union(
              set__to_be_added_classes
          )
      classes_to_create_list = [
          schema_json[item] for item in sorted(list(classes_to_create))
      ]
      self.create_schema({"classes": classes_to_create_list})
  
imports: from __future__ import annotations
  import contextlib
  import json
  import warnings
  from functools import cached_property
  from typing import TYPE_CHECKING, Any, Dict, List, Sequence, cast
  import requests
  import weaviate.exceptions
  from tenacity import Retrying, retry, retry_if_exception, retry_if_exception_type, stop_after_attempt
  from weaviate import Client
  from weaviate.auth import AuthApiKey, AuthBearerToken, AuthClientCredentials, AuthClientPassword
  from weaviate.data.replication import ConsistencyLevel
  from weaviate.exceptions import ObjectAlreadyExistsException
  from weaviate.util import generate_uuid5
  from airflow.exceptions import AirflowProviderDeprecationWarning
  from airflow.hooks.base import BaseHook
label_desc: Use image node_id 15 for calling the WeaviateHook obj's underlying member method code with example usage: obj.create_or_replace_classes(schema_json, existing) without return types