def spider_db_to_table_tuples(db):
  """Return list of abstract_sql.TableSchema from spider json."""
  # The format of the db json object is documented here:
  # https://github.com/taoyds/spider#tables
  # List of string table names.
  table_names = db['table_names_original']
  # List of lists with [table_idx, column_name].
  column_list = db['column_names_original']
  column_names_indexed_by_table = [[] for _ in table_names]
  for column in column_list:
    column_names_indexed_by_table[column[0]].append(column[1].lower())
  table_schemas = []
  for table_name, column_names in zip(table_names,
                                      column_names_indexed_by_table):
    table_schemas.append(
        abstract_sql.TableSchema(
            table_name=table_name.lower(),
            column_names=column_names,
        ))
  return table_schemas
Return list of abstract_sql.TableSchema from spider json.
language/xsp/data_preprocessing/abstract_sql_converters.py