Returns the table that has an index with the given name and schema.
4716
Table findUserTableForIndex(Session session, String name,
                                String schemaName) {

        Schema   schema    = (Schema) schemaMap.get(schemaName);
        HsqlName indexName = schema.indexLookup.getName(name);

        if (indexName == null) {
            return null;
        }

        return findUserTable(session, indexName.parent.name, schemaName);
    }
1220825
def _get_schema(name):
  
  item = datalab.utils.commands.get_notebook_item(name)
  if not item:
    item = _get_table(name)

  if isinstance(item, datalab.bigquery.Schema):
    return item
  if hasattr(item, 'schema') and isinstance(item.schema, datalab.bigquery._schema.Schema):
    return item.schema
  return None
283372
def index_exists(engine: Engine, tablename: str, indexname: str) -> bool:
    
    insp = Inspector.from_engine(engine)
    return any(i['name'] == indexname for i in insp.get_indexes(tablename))
1008514
def find_by_index(self, cls, index_name, value):
        """"""
        query_args = {
            index_name + '__eq': DynamoMappings.map_index_val(value),
            'index': gsi_name(index_name)
        }

        final_results = []
        for db_result in self.get_class_table(cls).query_2(**query_args):
            obj = cls.from_data(db_result['value'])
            final_results.append(obj)

        return final_results
11164
def get_table(self, tablename):
        
        temp = filter(lambda x: x.name == tablename, self.tables)
        if temp == list():
            raise Exception("No such table")
        return temp[0]
126680
def mssql_get_pk_index_name(engine: Engine,
                            tablename: str,
                            schemaname: str = MSSQL_DEFAULT_SCHEMA) -> str:
    
    # http://docs.sqlalchemy.org/en/latest/core/connections.html#sqlalchemy.engine.Connection.execute  # noqa
    # http://docs.sqlalchemy.org/en/latest/core/sqlelement.html#sqlalchemy.sql.expression.text  # noqa
    # http://docs.sqlalchemy.org/en/latest/core/sqlelement.html#sqlalchemy.sql.expression.TextClause.bindparams  # noqa
    # http://docs.sqlalchemy.org/en/latest/core/connections.html#sqlalchemy.engine.ResultProxy  # noqa
    query = text("""
SELECT
    kc.name AS index_name
FROM
    sys.key_constraints AS kc
    INNER JOIN sys.tables AS ta ON ta.object_id = kc.parent_object_id
    INNER JOIN sys.schemas AS s ON ta.schema_id = s.schema_id
WHERE
    kc.[type] = 'PK'
    AND ta.name = :tablename
    AND s.name = :schemaname
    """).bindparams(
        tablename=tablename,
        schemaname=schemaname,
    )
    with contextlib.closing(
            engine.execute(query)) as result:  # type: ResultProxy  # noqa
        row = result.fetchone()
        return row[0] if row else ''
235921
private int getTableIndex(String tableName) {

        int index;

        // System.out.println("begin searching for "+tableName);
        for (index = 0; index < vHoldTableNames.size(); index++) {

            // System.out.println("in getTableIndex searching for "+tableName+", index: "+index);
            if (tableName.equals((String) vHoldTableNames.elementAt(index))) {
                return index;
            }    // end of if (tableName.equals(vHoldTableNames.elementAt(index)))
        }        // end of for (index = 0; index < vHoldTableNames.size(); index ++)

        return -1;
    }
1196260
public Entity getEntityBySchemaAndTableName(String schemaName, String tableName) {
        return currentEntitiesBySchemaAndTableName.get(Table.keyForMap(schemaName, tableName));
    }
1339070
def get_table(table_name):
    
    try:
        table = Table(table_name, connection=DYNAMODB_CONNECTION)
    except DynamoDBResponseError as error:
        dynamodb_error = error.body['__type'].rsplit('#', 1)[1]
        if dynamodb_error == 'ResourceNotFoundException':
            logger.error(
                '{0} - Table {1} not found'.format(table_name, table_name))

        raise

    return table
564673
def index_exists(self, table: str, indexname: str) -> bool:
        """"""
        # MySQL:
        sql = ("SELECT COUNT(*) FROM information_schema.statistics"
               " WHERE table_name=? AND index_name=?")
        row = self.fetchone(sql, table, indexname)
        return True if row[0] >= 1 else False
959719
def has_table(self, name):
        """"""
        return len(self.sql("SELECT name FROM sqlite_master WHERE type='table' AND name=?",
                            parameters=(name,), asrecarray=False, cache=False)) > 0
1247081
public int getIndex(String name) throws SQLException {
    if (name == null) {
      throw new SQLException("Column name cannot be null");
    }
    String lowerName = name.toLowerCase(Locale.ROOT);
    // The specs in JDBC 4.0 specify that ResultSet.findColumn and
    // ResultSet.getXXX(String name) should use column alias (AS in the query). If label is not found, we use
    // original table name.
    if (aliasMap == null) {
      aliasMap = new HashMap<>();
      int counter = 0;
      for (ColumnInformation ci : columnInfo) {
        String columnAlias = ci.getName();
        if (columnAlias != null) {
          columnAlias = columnAlias.toLowerCase(Locale.ROOT);
          aliasMap.putIfAbsent(columnAlias, counter);

          String tableName = ci.getTable();
          if (tableName != null) {
            aliasMap.putIfAbsent(tableName.toLowerCase(Locale.ROOT) + "." + columnAlias, counter);
          }
        }
        counter++;
      }
    }

    Integer res = aliasMap.get(lowerName);
    if (res != null) {
      return res;
    }

    if (originalMap == null) {
      originalMap = new HashMap<>();
      int counter = 0;
      for (ColumnInformation ci : columnInfo) {
        String columnRealName = ci.getOriginalName();
        if (columnRealName != null) {
          columnRealName = columnRealName.toLowerCase(Locale.ROOT);
          originalMap.putIfAbsent(columnRealName, counter);

          String tableName = ci.getOriginalTable();
          if (tableName != null) {
            originalMap
                .putIfAbsent(tableName.toLowerCase(Locale.ROOT) + "." + columnRealName, counter);
          }
        }
        counter++;
      }
    }

    res = originalMap.get(lowerName);

    if (res == null) {
      throw ExceptionMapper.get("No such column: " + name, "42S22", 1054, null, false);
    }
    return res;

  }
356836
public function getTable($name)
    {
        if (!$this->hasTable($name)) {
            throw SchemaException::schemaTableDoesNotExist($this->getName(), $name);
        }

        return $this->tables[$name];
    }
1244105
String tableNameForIndexName(String indexName) {
        // the schema manager has a map of indexes by name
        // if this shows up on profiles, you can try to use that, but beware
        // the case insensitivity going on here
        HashMappedList hsqlTables = getHSQLTables();
        for (int i = 0; i < hsqlTables.size(); i++) {
            Table table = (Table) hsqlTables.get(i);
            for (Index index : table.getIndexList()) {
                if (index.getName().name.equalsIgnoreCase(indexName)) {
                    return table.getName().name.toLowerCase();
                }
            }
        }
        return null;
    }
1046929
def find_by_index(self, cls, index_name, value):
        """"""
        table_name = cls.get_table_name()
        index_name_vals = [(index_name, value)]

        final_results = []
        for db_result in read_by_indexes(table_name, index_name_vals):
            obj = cls.from_data(db_result['value'])
            final_results.append(obj)

        return final_results
1274041
def table_schema_call(self, target, cls):
        
        index_defs = []
        for name in cls.index_names() or []:
            index_defs.append(GlobalIncludeIndex(
                gsi_name(name),
                parts=[HashKey(name)],
                includes=['value']
            ))

        return target(
            cls.get_table_name(),
            connection=get_conn(),
            schema=[HashKey('id')],
            global_indexes=index_defs or None
        )
1362155
def get_table(self, tablename):
        
        table, (_row, _col) = self.__tables[tablename]
        return table