class_docstr: Handles CRUD operations at the database level for Skills
docstr: Updates an existing skill in the database.
  
  Parameters:
      skill_name (str): The name of the new skill, or existing skill to update
      new_name (str): Updated name of the skill
      project_name (str): The containing project
      type (str): The type of the skill (e.g. Knowledge Base)
      params: (Dict[str, str]): Parameters associated with the skill
  
  Returns:
      bot (db.Skills): The updated skill
  
  Raises:
      ValueError: If `project_name` does not exist or skill doesn't exist
docstr_tok: ["Updates","an","existing","skill","in","the","database",".","Parameters",":","skill_name","(","str",")",":","The","name","of","the","new","skill",",","or","existing","skill","to","update","new_name","(","str",")",":","Updated","name","of","the","skill","project_name","(","str",")",":","The","containing","project","type","(","str",")",":","The","type","of","the","skill","(","e.g",".","Knowledge","Base",")","params",":","(","Dict","[","str",",","str","]",")",":","Parameters","associated","with","the","skill","Returns",":","bot","(","db.Skills",")",":","The","updated","skill","Raises",":","ValueError",":","If","`","project_name","`","does","not","exist","or","skill","does","n't","exist"]
code: def update_skill(
      self,
      skill_name: str,
      new_name: str = None,
      project_name: str = "mindsdb",
      type: str = None,
      params: Dict[str, str] = None,
  ):
      """
      Updates an existing skill in the database.
  
      Parameters:
          skill_name (str): The name of the new skill, or existing skill to update
          new_name (str): Updated name of the skill
          project_name (str): The containing project
          type (str): The type of the skill (e.g. Knowledge Base)
          params: (Dict[str, str]): Parameters associated with the skill
  
      Returns:
          bot (db.Skills): The updated skill
  
      Raises:
          ValueError: If `project_name` does not exist or skill doesn't exist
      """
  
      existing_skill = self.get_skill(skill_name, project_name)
      if existing_skill is None:
          raise ValueError(f"Skill with name not found: {skill_name}")
  
      if new_name is not None:
          existing_skill.name = new_name
      if type is not None:
          existing_skill.type = type
      if params is not None:
          # Merge params on update
          existing_params = (
              {} if not existing_skill.params else existing_skill.params
          )
          existing_params.update(params)
          # Remove None values entirely.
          params = {
              k: v for k, v in existing_params.items() if v is not None
          }
          existing_skill.params = params
          # Some versions of SQL Alchemy won't handle JSON updates correctly without this.
          # See: https://docs.sqlalchemy.org/en/20/orm/session_api.html#sqlalchemy.orm.attributes.flag_modified
          flag_modified(existing_skill, "params")
  
      db.session.commit()
  
      return existing_skill
  
file_path: mindsdb/mindsdb/interfaces/skills/skills_controller.py
imports: from typing import Dict, List
  from mindsdb.interfaces.storage import db
  from mindsdb.interfaces.database.projects import ProjectController
  from sqlalchemy.orm.attributes import flag_modified
label_desc: Use image node_id 5 for calling the SkillsController obj's underlying member method code with example usage: obj.update_skill(skill_name, new_name, project_name, type, params) and returns: existing_skill