class_docstr: Knowledge base controller handles all
  manages knowledge bases
class_docstr_tok: ["Knowledge","base","controller","handles","all","manages","knowledge","bases"]
docstr: Delete a knowledge base from the database
docstr_tok: ["Delete","a","knowledge","base","from","the","database"]
code: def delete(
      self, name: str, project_name: str, if_exists: bool = False
  ) -> None:
      """
      Delete a knowledge base from the database
      """
      try:
          project = self.session.database_controller.get_project(
              project_name
          )
      except ValueError:
          raise ValueError(f"Project not found: {project_name}")
      project_id = project.id
  
      # check if knowledge base exists
      kb = self.get(name, project_id)
      if kb is None:
          # knowledge base does not exist
          if if_exists:
              return
          else:
              raise EntityNotExistsError(
                  "Knowledge base does not exist", name
              )
  
      # drop table
      vector_db = db.Integration.query.get(kb.vector_database_id)
      if vector_db:
          database_name = vector_db.name
          self.session.datahub.get(
              database_name
          ).integration_handler.drop_table(kb.vector_database_table)
  
      # kb exists
      db.session.delete(kb)
      db.session.commit()
  
imports: import copy
  from typing import List
  import pandas
  import mindsdb_sql.planner.utils
  from mindsdb_sql.parser.ast import BinaryOperation, Constant, Identifier, Select, Update, Delete, Star
  from mindsdb_sql.parser.dialects.mindsdb import CreatePredictor
  import mindsdb.interfaces.storage.db
  from mindsdb.integrations.libs.vectordatabase_handler import TableField
  from mindsdb.utilities.exception import EntityExistsError, EntityNotExistsError
label_desc: Use image node_id 5 for calling the KnowledgeBaseController obj's underlying member method code with example usage: obj.delete(name, project_name, if_exists) without return types