class_docstr: Construct a SQLite database with a folder of notebooks
docstr: Index notebooks
  
  Parameters
  ----------
  verbose : bool, default=True
      If True, it prints one message per notebook
  
  update : bool, default=False
      If True, it updates the entry in the database if the path already
      exists
docstr_tok: ["Index","notebooks","Parameters","--","--","--","--","--","verbose",":","bool",",","default=True","If","True",",","it","prints","one","message","per","notebook","update",":","bool",",","default=False","If","True",",","it","updates","the","entry","in","the","database","if","the","path","already","exists"]
code: def index(self, verbose=True, update=False):
      """Index notebooks
  
      Parameters
      ----------
      verbose : bool, default=True
          If True, it prints one message per notebook
  
      update : bool, default=False
          If True, it updates the entry in the database if the path already
          exists
      """
      for path in iglob(self._pattern, recursive=True):
          try:
              nb = NotebookIntrospector(path)
          except Exception as e:
              if verbose:
                  print(f"Error loading {path}: {e}")
              continue
  
          paths_indexed = self._get_paths()
  
          if path not in paths_indexed:
              if verbose:
                  print(f"Indexing {path}")
  
              data = nb.to_json_serializable()
  
              cur = self._conn.cursor()
              cur.execute(
                  """
          INSERT INTO nbs (c, path)
          VALUES(?, ?)
          """,
                  [
                      json.dumps(data),
                      path,
                  ],
              )
  
              cur.close()
  
              self._conn.commit()
          elif path in paths_indexed and update:
              if verbose:
                  print(f"Updating {path}")
  
              data = nb.to_json_serializable()
  
              cur = self._conn.cursor()
              cur.execute(
                  """
          UPDATE nbs SET c = ?
          WHERE path = ?
          """,
                  [
                      json.dumps(data),
                      path,
                  ],
              )
  
              cur.close()
  
              self._conn.commit()
          elif verbose:
              print(f"{path} already indexed. Skipping...")
  
file_path: sklearn-evaluation/src/sklearn_evaluation/nb/NotebookDatabase.py
imports: import json
  import sqlite3
  from glob import iglob
  from .NotebookIntrospector import NotebookIntrospector
label_desc: Use image node_id 2 for calling the NotebookDatabase obj's underlying member method code with example usage: obj.index(verbose, update) without return types