def extract_config_name()

in cicd-deployers/dataform_runner.py [0:0]


def extract_config_name(file_path):
  """
  Extracts the config name from a Dataform SQLX file.

  Args:
    file_path: Path to the SQLX file.

  Returns:
    The config name as a string, or None if not found.
  """
  try:
    with open(file_path, 'r') as f:
      content = f.read()

    match = re.search(r'config \{.*?name: "(.*?)"', content, re.DOTALL)
    if match:
      return match.group(1)
    else:
      logging.info(f"Config name not found in {file_path}.")
      return None
  except FileNotFoundError:
    logging.info(f"File not found: {file_path}")
    return None