docs: def load(self, ds, verbose=False):
          """
          Load a CLDF dataset into the database.
  
          :param dataset:
          :return:
          """
          try:
              self.fetchone('select ID from dataset')
          except sqlite3.OperationalError:
              self.create(force=True)
          self.unload(ds)
          dataset = ds.cldf.wl
          tables, ref_tables = schema(dataset)
  
          # update the DB schema:
          for t in tables:
              if self._create_table_if_not_exists(t):
                  continue
              db_cols = self.tables[t.name]
              for col in t.columns:
                  if col.name not in db_cols:
                      with self.connection() as conn:
                          conn.execute(
                              "ALTER TABLE {0} ADD COLUMN `{1.name}` {1.db_type}".format(
                                  t.name, col))
                  else:
                      if db_cols[col.name] != col.db_type:
                          raise ValueError(
                              'column {0}:{1} {2} redefined with new type {3}'.format(
                                  t.name, col.name, db_cols[col.name], col.db_type))
  
          for t in ref_tables.values():
              self._create_table_if_not_exists(t)
  
          self.update_schema()
  
          # then load the data:
          with self.connection() as db:
              db.execute('PRAGMA foreign_keys = ON;')
              insert(
                  db,
                  'dataset',
                  'ID,name,version,metadata_json',
                  (
                      ds.id,
                      '{0}'.format(dataset),
                      git_hash(ds.dir),
                      dumps(dataset.metadata_dict)))
              insert(
                  db,
                  'datasetmeta',
                  'dataset_ID,key,value',
                  *[(ds.id, k, '{0}'.format(v)) for k, v in dataset.properties.items()])
  
              # load sources:
              rows = []
              for src in dataset.sources.items():
                  values = [ds.id, src.id, src.genre] + [src.get(k) for k in BIBTEX_FIELDS]
                  values.append(
                      dumps({k: v for k, v in src.items() if k not in BIBTEX_FIELDS}))
                  rows.append(tuple(values))
              insert(
                  db,
                  'SourceTable',
                  ['dataset_ID', 'ID', 'bibtex_type'] + BIBTEX_FIELDS + ['extra'],
                  *rows)
  
              # For regular tables, we extract and keep references to sources.
              refs = defaultdict(list)
  
              for t in tables:
                  # We want to lookup columns by the name used in the CLDF dataset.
                  cols = {col.cldf_name: col for col in t.columns}
                  # But we also want to look up primary keys by the database column name.
                  cols_by_name = {col.name: col for col in t.columns}
  
                  ref_table = ref_tables.get(t.name)
                  rows, keys = [], []
                  try:
                      for row in dataset[t.name]:
                          keys, values = ['dataset_ID'], [ds.id]
                          for k, v in row.items():
                              if ref_table and k == ref_table.consumes:
                                  col = cols_by_name[t.primary_key]
                                  refs[ref_table.name].append((row[col.cldf_name], v))
                              else:
                                  col = cols[k]
                                  if isinstance(v, list):
                                      v = (col.separator or ';').join(
                                          nfilter(col.convert(vv) for vv in v))
                                  else:
                                      v = col.convert(v)
                                  keys.append("`{0}`".format(col.name))
                                  values.append(v)
                          keys, values = self.update_row(t.name, keys, values)
                          rows.append(tuple(values))
                      insert(db, t.name, keys, *rows, **{'verbose': verbose})
                  except FileNotFoundError:
                      if t.name != 'CognateTable':  # An empty CognateTable is allowed.
                          raise  # pragma: no cover
  
              # Now insert the references, i.e. the associations with sources:
              for tname, items in refs.items():
                  rows = []
                  for oid, sources in items:
                      for source in sources:
                          sid, context = Sources.parse(source)
                          rows.append([ds.id, oid, sid, context])
                  oid_col = '{0}_ID'.format(tname.replace('Source', ''))
                  insert(db, tname, ['dataset_ID', oid_col, 'Source_ID', 'Context'], *rows)
              db.commit()