code: def namedb_find_missing_and_extra(cur, record, table_name):
      
      rec_missing = []
      rec_extra = []
      
      # sanity check: all fields must be defined
      name_fields_rows = db_query_execute(cur, 'PRAGMA table_info({})'.format(table_name), ())
      name_fields = []
      for row in name_fields_rows:
          name_fields.append( row['name'] )
  
      # make sure each column has a record field
      for f in name_fields:
          if f not in record.keys():
              rec_missing.append( f )
  
      # make sure each record field has a column
      for k in record.keys():
          if k not in name_fields:
              rec_extra.append( k )
  
      return rec_missing, rec_extra
docs: Find the set of fields missing from record, and set of extra fields from record, based on the db schema.
      Return (missing, extra)