Filter provided schemas using tableNames and
include schemas dependencies.

@param {[Schema]} schemas
@param {[String]} tableNames
@param {Function} callback
199368
function filterSchemas(schemas, tableNames, callback) {
  if (! (schemas || []).length || ! (tableNames || []).length)
    return process.nextTick(_.partial(callback, null, schemas || []));

  var schemasMap = _.indexBy(schemas, 'tableName');
  var filteredSchemas = _.chain(schemasMap).pick(tableNames).toArray().value();
  resolveSchemasDeps(filteredSchemas, schemasMap, callback);
}
1059542
public function table($table, Closure $callback)
    {
    	if(!$this->hasTable($table)) {
    		return hst_message('is has table');
    	}
        \Schema::connection($this->databaseName)->table($table, $callback);
    }
1090975
private boolean prepareManagedSchema(String tableName,
      String entitySchemaString) {
    String entityName = getEntityNameFromSchemaString(entitySchemaString);
    AvroEntitySchema entitySchema = parser
        .parseEntitySchema(entitySchemaString);
    AvroKeySchema keySchema = parser.parseKeySchema(entitySchemaString);
    // Verify there are no ambiguities with the managed schemas
    if (schemaManager.hasManagedSchema(tableName, entityName)) {
      KeySchema currentKeySchema = schemaManager
          .getKeySchema(tableName, entityName);
      if (!keySchema.equals(currentKeySchema)) {
        String msg =
            "Migrating schema with different keys. Current: " + currentKeySchema
                .getRawSchema() + " New: " + keySchema.getRawSchema();
        LOG.error(msg);
        throw new ValidationException(msg);
      }
      if (!schemaManager
          .hasSchemaVersion(tableName, entityName, entitySchema)) {
        LOG.info("Migrating Schema: (" + tableName + ", " + entityName + ")");
        schemaManager.migrateSchema(tableName, entityName, entitySchemaString);
      } else {
        LOG.info("Schema hasn't changed, not migrating: (" + tableName + ", "
            + entityName + ")");
        return false;
      }
    } else {
      LOG.info("Creating Schema: (" + tableName + ", " + entityName + ")");
      parser.parseEntitySchema(entitySchemaString).getColumnMappingDescriptor()
          .getRequiredColumnFamilies();
      schemaManager.createSchema(tableName, entityName, entitySchemaString,
          "org.kitesdk.data.hbase.avro.AvroKeyEntitySchemaParser",
          "org.kitesdk.data.hbase.avro.AvroKeySerDe",
          "org.kitesdk.data.hbase.avro.AvroEntitySerDe");
    }
    return true;
  }
1332073
public function createTables(array $tableCreates, SchemaCheck $response)
    {
        foreach ($tableCreates as $tableName => $tableCreate) {
            $this->createTable($tableName, $tableCreate, $response);
        }
    }
79824
protected void create(List<TableInfo> tableInfos)
    {
        try
        {
            createOrUpdateKeyspace(tableInfos);
        }
        catch (Exception ex)
        {
            throw new SchemaGenerationException(ex);
        }
    }
744815
function(modelJs) {
    let web = this;
    let modelName = modelJs.name;
    
    if (!modelJs.schema) {
      throw new Error(modelName + '.schema not found.');
    }

    let collectionName = undefined;
    if (modelJs.parentModel) {
      
      let parentModel = web.includeModel(modelJs.parentModel);
      let parentModelJs = parentModel.getModelDictionary();
      collectionName = parentModel.collection.name;

      modelJs.schema = extend(parentModelJs.schema, modelJs.schema);
      
      let origSchema = modelJs.initSchema;
      modelJs.initSchema = [];
      if (origSchema) {
        modelJs.initSchema.push(origSchema);
      }

      if (parentModelJs.initSchema) {
        modelJs.initSchema.push(parentModelJs.initSchema);
      }

      modelJs.options = extend(parentModel.options || {}, modelJs.options);

      if (console.isDebug) {
        console.debug('Model %s has a parent %s', modelName, modelJs.parentModel);
      }

    }

    let conn;

    let getModelConnection = function(modelJs) {
      if (modelJs.connection) {
        return modelJs.connection
      }
      
      if (modelJs.parentModel) {
        return getModelConnection(web.include(modelJs.parentModel));
      }
    }

    let modelConn = getModelConnection(modelJs);
    if (modelConn) {
      conn = this.connections[modelConn];
      if (web.conf.isDebug) {
        console.debug("Found model conn: ", modelJs.name, modelConn);
      }
    } else if (web.connections.mainDb) {
      conn = web.connections.mainDb; 
    } else {
    for (let i in this.connections) {
        //get the first connection
        conn = this.connections[i];
        break;
      }
    }

    if (!conn) {
      console.warn('No defined DB. Check your configuration.');
      return;
    }
    
    let schema = new Schema(modelJs.schema, modelJs.options);

    //TODO: executing schemas of children are not a good idea
    if (modelJs.initSchema) {
      if (modelJs.initSchema instanceof Array) {
        for (let i in modelJs.initSchema) {
          let mySchema = modelJs.initSchema[i];
          
          mySchema(schema);
        }
      } else {
        //console.debug('[%s] Executing normal initSchema %s', modelJs.name ,modelJs.initSchema);
        //fixed bug where schemas are execd twice
        if (!modelJs.initSchema.execd) {
          modelJs.initSchema(schema);
        }
      }
      
    }

    let model = conn.model(modelName, schema, collectionName);
    if (console.isDebug) {
      console.debug("Loaded model for the first time: " + modelName)
    }

    web.modelCache[modelName] = model;
    model.getModelDictionary = function() {
      return modelJs;
    }        
    return model;
  }
836473
function checkForReservedTableName(args) {
  if (!args) {
    return;
  }
  if (args.databaseTypeName) {
    checkTableName(args.name, args.databaseTypeName, args.shouldThrow);
  } else {
    for (let i = 0, types = Object.keys(DatabaseTypes); i < types.length; i++) {
      if (typeof DatabaseTypes[types[i]] !== 'function') {
        checkTableName(args.name, DatabaseTypes[types[i]], args.shouldThrow);
      }
    }
  }
}
1038968
protected void validate(List<TableInfo> tableInfos)
    {
        db = mongo.getDB(databaseName);
        if (db == null)
        {
            logger.error("Database " + databaseName + "does not exist");
            throw new SchemaGenerationException("database " + databaseName + "does not exist", "mongoDb", databaseName);
        }
        else
        {
            for (TableInfo tableInfo : tableInfos)
            {
                if (tableInfo.getLobColumnInfo().isEmpty())
                {
                    if (!db.collectionExists(tableInfo.getTableName()))
                    {
                        logger.error("Collection " + tableInfo.getTableName() + "does not exist in db " + db.getName());
                        throw new SchemaGenerationException("Collection " + tableInfo.getTableName()
                                + " does not exist in db " + db.getName(), "mongoDb", databaseName,
                                tableInfo.getTableName());
                    }
                }
                else
                {
                    checkMultipleLobs(tableInfo);
                    if (!db.collectionExists(tableInfo.getTableName() + MongoDBUtils.FILES))
                    {
                        logger.error("Collection " + tableInfo.getTableName() + MongoDBUtils.FILES
                                + "does not exist in db " + db.getName());
                        throw new SchemaGenerationException("Collection " + tableInfo.getTableName()
                                + " does not exist in db " + db.getName(), "mongoDb", databaseName,
                                tableInfo.getTableName());
                    }
                    if (!db.collectionExists(tableInfo.getTableName() + MongoDBUtils.CHUNKS))
                    {
                        logger.error("Collection " + tableInfo.getTableName() + MongoDBUtils.CHUNKS
                                + "does not exist in db " + db.getName());
                        throw new SchemaGenerationException("Collection " + tableInfo.getTableName()
                                + " does not exist in db " + db.getName(), "mongoDb", databaseName,
                                tableInfo.getTableName());
                    }

                }
            }
        }
    }
1334272
public void setSchemaArns(java.util.Collection<String> schemaArns) {
        if (schemaArns == null) {
            this.schemaArns = null;
            return;
        }

        this.schemaArns = new java.util.ArrayList<String>(schemaArns);
    }
380630
public void setSchemas(java.util.Collection<String> schemas) {
        if (schemas == null) {
            this.schemas = null;
            return;
        }

        this.schemas = new java.util.ArrayList<String>(schemas);
    }
736868
def _catalog_filter_schemas(manifest):
    
    schemas = frozenset((d.lower(), s.lower())
                        for d, s in manifest.get_used_schemas())

    def test(row):
        table_database = _expect_row_value('table_database', row)
        table_schema = _expect_row_value('table_schema', row)
        # the schema may be present but None, which is not an error and should
        # be filtered out
        if table_schema is None:
            return False
        return (table_database.lower(), table_schema.lower()) in schemas
    return test
807078
function resolveSchemasDeps(schemas, schemasMap, callback) {
  async.reduce(schemas, [], function (result, schema, next) {
    tryAndDelay(resolveSchemaDeps, result, schema, schemasMap, next);
  }, function (err, result) {
    return err ? callback(err) : callback(null, _.uniq(result));
  });
}
1029760
function getTableDefinition(tableDefinitions, tableName) {
    Validate.isObject(tableDefinitions);
    Validate.notNull(tableDefinitions);
    Validate.isString(tableName);
    Validate.notNullOrEmpty(tableName);

    return tableDefinitions[tableName.toLowerCase()];
}
585242
function name (column, table, schema) {
    if (this.typecheck) t.typecheck('name', [column, table, schema]);

    var result = [];
    schema && result.push(this.quotes(schema));
    table && result.push(this.quotes(table));
    column && result.push(this.quotes(column));
    return result.join('.');
}
1070658
function dependenciesExists(schema) {
    var deps = DependenciesMap[schema];
    var f = false;
    deps.forEach(function (d) {
        f = SavedSchemas.indexOf(d) > -1
    });
    return f;
}
423076
function reset(schemas) {
  var resolver = new Resolver(schemas);
  // Reduce force sequential execution.
  return Promise.reduce(resolver.resolve().reverse(), resetSchema.bind(this), []);
}
411425
public void setTableNames(java.util.Collection<String> tableNames) {
        if (tableNames == null) {
            this.tableNames = null;
            return;
        }

        java.util.List<String> tableNamesCopy = new java.util.ArrayList<String>(tableNames.size());
        tableNamesCopy.addAll(tableNames);
        this.tableNames = tableNamesCopy;
    }