<commit_before>var _ = require('underscore');
var TableView = require('./table-view');
var QueryColumnsCollection = require('../../data/query-columns-collection');
var QueryRowsCollection = require('../../data/query-rows-collection');

/**
 *  Table manager that generates necessary models/collections
 *  for the view
 *
 */

module.exports = {
  create: function (opts) {
    _.each(['configModel', 'querySchemaModel'], function (key) {
      if (!opts[key]) throw new Error(key + ' is required');
    }, this);

    var columnsCollection = new QueryColumnsCollection(
      opts.querySchemaModel.columnsCollection.toJSON(),
      {
        configModel: opts.configModel,
        tableName: opts.tableName,
        querySchemaModel: opts.querySchemaModel
      }
    );

    var rowsCollection = new QueryRowsCollection(
      opts.querySchemaModel.rowsSampleCollection.toJSON(),
      {
        configModel: opts.configModel,
        tableName: opts.tableName,
        querySchemaModel: opts.querySchemaModel
      }
    );

    return new TableView({
      rowsCollection: rowsCollection,
      columnsCollection: columnsCollection,
      querySchemaModel: opts.querySchemaModel,
      tableName: opts.tableName,
      readonly: opts.readonly !== undefined ? opts.readonly : !opts.tableName
    });
  }
};<commit_msg>Don't use rows collection data<commit_after>var _ = require('underscore');
var TableView = require('./table-view');
var QueryColumnsCollection = require('../../data/query-columns-collection');
var QueryRowsCollection = require('../../data/query-rows-collection');

/**
 *  Table manager that generates necessary models/collections
 *  for the view
 *
 */

module.exports = {
  create: function (opts) {
    _.each(['configModel', 'querySchemaModel'], function (key) {
      if (!opts[key]) throw new Error(key + ' is required');
    }, this);

    var columnsCollection = new QueryColumnsCollection(
      opts.querySchemaModel.columnsCollection.toJSON(),
      {
        configModel: opts.configModel,
        tableName: opts.tableName,
        querySchemaModel: opts.querySchemaModel
      }
    );

    var rowsCollection = new QueryRowsCollection([],
      {
        configModel: opts.configModel,
        tableName: opts.tableName,
        querySchemaModel: opts.querySchemaModel
      }
    );

    return new TableView({
      rowsCollection: rowsCollection,
      columnsCollection: columnsCollection,
      querySchemaModel: opts.querySchemaModel,
      tableName: opts.tableName,
      readonly: opts.readonly !== undefined ? opts.readonly : !opts.tableName
    });
  }
};
{'fraction_non_alphanumeric': 0.12216673069535151, 'fraction_numerical': 0.0, 'mean_word_length': 3.1797752808988764, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3956047', 'n_tokens_mistral': 697, 'n_tokens_neox': 683, 'n_words': 151}