get [:tablename] {haskkey} [rangekey]
        or
        get [:tablename] ((hkey,rkey), (hkey,rkey)...)
329890
def do_get(self, line):
        

        table, line = self.get_table_params(line)

        if line.startswith('(') or line.startswith('[') or "," in line:
            print "batch: not yet implemented"
            return

            # list of IDs
            list = self.get_list(line)

            from collections import OrderedDict

            ordered = OrderedDict()
            for id in list:
                if not isinstance(id, tuple):
                    hkey = self.get_typed_key_value(table, unicode(id))
                    rkey = None
                else:
                    hkey = self.get_typed_key_value(table, unicode(id[0]), True)
                    rkey = self.get_typed_key_value(table, unicode(id[1]), False)

                ordered[(hkey, rkey)] = None

            batch = self.conn.new_batch_list()
            batch.add_batch(table, ordered.keys())
            response = batch.submit()

            hkey = table.schema.hash_key_name
            rkey = table.schema.range_key_name

            for item in response['Responses'][table.table_name]['Items']:
                ordered[(item.get(hkey), item.get(rkey))] = item

            self.pprint(filter(None, ordered.values()))
        else:
            args = self.getargs(line)

            key = self.get_key_name_value(table, args[0], True)
            print key

            if len(args) > 1:
                key.update(self.get_key_name_value(table, args[1], False))

            print key

            item = table.get_item(consistent=self.consistent, **key)
            self.pprint(item)

            if self.consumed:
                print "consumed units:", item.consumed_units
1281214
def indexes(table_name, name = nil)#:nodoc:
      indexes = []
      current_index = nil
      show_keys_from(table_name, name).each do |row|
        if current_index != row['Key_name']
          next if row['Key_name'] == "PRIMARY" # skip the primary key
          current_index = row['Key_name']
          indexes << ActiveRecord::ConnectionAdapters::IndexDefinition \
            .new(row['Table'], row['Key_name'], row['Non_unique'] == "0", [], row['Index_type'] == "SPATIAL")
        end
        indexes.last.columns << row['Column_name']
      end
      indexes
    end
1026614
private Map<String, Integer> getShardNumbers(String tableName, Set<String> targObjIDs) {
        TableDefinition tableDef = m_tableDef.getAppDef().getTableDef(tableName);
        FieldDefinition shardField = tableDef.getShardingField();
        Map<String, String> shardFieldMap =
           SpiderService.instance().getObjectScalar(tableDef, targObjIDs, shardField.getName());
        Map<String, Integer> shardNoMap = new HashMap<>();
        for (String objID : shardFieldMap.keySet()) {
            Date shardingFieldDate = Utils.dateFromString(shardFieldMap.get(objID));
            int shardNo = tableDef.computeShardNumber(shardingFieldDate);
            shardNoMap.put(objID, shardNo);
        }
        return shardNoMap;
    }
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;
    }
633282
protected List<String> getPrimaryKeys(String tableName) {
        List<String> pkCols = new ArrayList<String>();
        try {
            // Lower-case table names are required for PostgreSQL; we might need to
            // alter this if we use another comparison database (besides HSQL) someday
            ResultSet rs = dbconn.getMetaData().getPrimaryKeys(null, null, tableName.toLowerCase());
            while (rs.next()) {
                pkCols.add(rs.getString(4));
            }
        } catch (SQLException e) {
            printCaughtException("In NonVoltDBBackend.getPrimaryKeys, caught SQLException: " + e);
        }
        return pkCols;
    }
6799
def complete_key(name, field, val)
      return ["#{name}."] if !val || !val.is_a?(String) || !(val.include?('.'))
      val = val.sub(/.*\./,'')

      connection    = definition.klass.connection
      quoted_table  = field.key_klass.connection.quote_table_name(field.key_klass.table_name)
      quoted_field  = field.key_klass.connection.quote_column_name(field.key_field)
      field_name    = "#{quoted_table}.#{quoted_field}"

      field.key_klass
        .where(value_conditions(field_name, val))
        .select(field_name)
        .limit(20)
        .distinct
        .map(&field.key_field)
        .compact
        .map { |f| "#{name}.#{f} " }
    end
688757
public static function getCacheKey($key,$is_array = true) {
        if ($is_array) {
            return static::tableName().static::$pk.'is_array'.$key;
        } else {
            return static::tableName().static::$pk.$key;
        }

    }
101158
def get_ranges(self, element, key):
        
        keys = self.p['keys']
        ranges = self.p['ranges']

        if ranges == {}:
            return {d.name: element.range(d.name, self.data_range)
                    for d in element.dimensions()}
        if keys is None:
            specs = ranges
        elif keys and not isinstance(ranges, list):
            raise ValueError("Key list specified but ranges parameter"
                             " not specified as a list.")
        elif len(keys) == len(ranges):
            # Unpack any 1-tuple keys
            try:
                index = keys.index(key)
                specs = ranges[index]
            except:
                raise KeyError("Could not match element key to defined keys")
        else:
            raise ValueError("Key list length must match length of supplied ranges")

        return match_spec(element, specs)
1282884
def _select(self, tree, allow_select_scan):
        
        tablename = tree.table
        desc = self.describe(tablename, require=True)
        kwargs = {}
        if tree.consistent:
            kwargs["consistent"] = True

        visitor = Visitor(self.reserved_words)

        selection = SelectionExpression.from_selection(tree.attrs)
        if selection.is_count:
            kwargs["select"] = "COUNT"

        if tree.keys_in:
            if tree.limit:
                raise SyntaxError("Cannot use LIMIT with KEYS IN")
            elif tree.using:
                raise SyntaxError("Cannot use USING with KEYS IN")
            elif tree.order:
                raise SyntaxError("Cannot use DESC/ASC with KEYS IN")
            elif tree.where:
                raise SyntaxError("Cannot use WHERE with KEYS IN")
            keys = list(self._iter_where_in(tree))
            kwargs["attributes"] = selection.build(visitor)
            kwargs["alias"] = visitor.attribute_names
            return self.connection.batch_get(tablename, keys=keys, **kwargs)

        if tree.limit:
            if tree.scan_limit:
                kwargs["limit"] = Limit(
                    scan_limit=resolve(tree.scan_limit[2]),
                    item_limit=resolve(tree.limit[1]),
                    strict=True,
                )
            else:
                kwargs["limit"] = Limit(item_limit=resolve(tree.limit[1]), strict=True)
        elif tree.scan_limit:
            kwargs["limit"] = Limit(scan_limit=resolve(tree.scan_limit[2]))

        (action, query_kwargs, index) = self._build_query(desc, tree, visitor)
        if action == "scan" and not allow_select_scan:
            raise SyntaxError(
                "No index found for query. Please use a SCAN query, or "
                "set allow_select_scan=True\nopt allow_select_scan true"
            )
        order_by = None
        if tree.order_by:
            order_by = tree.order_by[0]
        reverse = tree.order == "DESC"
        if tree.order:
            if action == "scan" and not tree.order_by:
                raise SyntaxError(
                    "No index found for query, "
                    "cannot use ASC or DESC without "
                    "ORDER BY <field>"
                )
            if action == "query":
                if order_by is None or order_by == index.range_key:
                    kwargs["desc"] = reverse

        kwargs.update(query_kwargs)

        # This is a special case for when we're querying an index and selecting
        # fields that aren't projected into the index.
        # We will change the query to only fetch the primary keys, and then
        # fill in the selected attributes after the fact.
        fetch_attrs_after = False
        if index is not None and not index.projects_all_attributes(
            selection.all_fields
        ):
            kwargs["attributes"] = [
                visitor.get_field(a) for a in desc.primary_key_attributes
            ]
            fetch_attrs_after = True
        else:
            kwargs["attributes"] = selection.build(visitor)
        kwargs["expr_values"] = visitor.expression_values
        kwargs["alias"] = visitor.attribute_names

        method = getattr(self.connection, action + "2")
        result = method(tablename, **kwargs)

        # If the queried index didn't project the selected attributes, we need
        # to do a BatchGetItem to fetch all the data.
        if fetch_attrs_after:
            if not isinstance(result, list):
                result = list(result)
            # If no results, no need to batch_get
            if not result:
                return result
            visitor = Visitor(self.reserved_words)
            kwargs = {"keys": [desc.primary_key(item) for item in result]}
            kwargs["attributes"] = selection.build(visitor)
            kwargs["alias"] = visitor.attribute_names
            result = self.connection.batch_get(tablename, **kwargs)

        def order(items):
            """ Sort the items by the specified keys """
            if order_by is None:
                return items
            if index is None or order_by != index.range_key:
                if not isinstance(items, list):
                    items = list(items)
                items.sort(key=lambda x: x.get(order_by), reverse=reverse)
            return items

        # Save the data to a file
        if tree.save_file:
            if selection.is_count:
                raise Exception("Cannot use count(*) with SAVE")
            count = 0
            result = order(selection.convert(item, True) for item in result)
            filename = tree.save_file[0]
            if filename[0] in ['"', "'"]:
                filename = unwrap(filename)
            # If it's still an iterator, convert to a list so we can iterate
            # multiple times.
            if not isinstance(result, list):
                result = list(result)
            remainder, ext = os.path.splitext(filename)
            if ext.lower() in [".gz", ".gzip"]:
                ext = os.path.splitext(remainder)[1]
                opened = gzip.open(filename, "wb")
            else:
                opened = open(filename, "wb")
            if ext.lower() == ".csv":
                if selection.all_keys:
                    headers = selection.all_keys
                else:
                    # Have to do this to get all the headers :(
                    result = list(result)
                    all_headers = set()
                    for item in result:
                        all_headers.update(item.keys())
                    headers = list(all_headers)
                with opened as ofile:
                    writer = csv.DictWriter(
                        ofile, fieldnames=headers, extrasaction="ignore"
                    )
                    writer.writeheader()
                    for item in result:
                        count += 1
                        writer.writerow(item)
            elif ext.lower() == ".json":
                with opened as ofile:
                    for item in result:
                        count += 1
                        ofile.write(self._encoder.encode(item))
                        ofile.write("\n")
            else:
                with opened as ofile:
                    for item in result:
                        count += 1
                        pickle.dump(item, ofile)
            return count
        elif not selection.is_count:
            result = order(selection.convert(item) for item in result)

        return result
241912
function indexKeys(target, pred) {
  pred = pred || has;
  var results = [];

  for (var i = 0, len = target.length; i < len; i += 1) {
    if (pred(target, i)) {
      results.push(String(i));
    }
  }

  return results;
}
606666
def get_tables_and_gsis():
    
    table_names = set()
    configured_tables = get_configured_tables()
    not_used_tables = set(configured_tables)

    # Add regexp table names
    for table_instance in list_tables():
        for key_name in configured_tables:
            try:
                if re.match(key_name, table_instance.table_name):
                    logger.debug("Table {0} match with config key {1}".format(
                        table_instance.table_name, key_name))

                    # Notify users about regexps that match multiple tables
                    if table_instance.table_name in [x[0] for x in table_names]:
                        logger.warning(
                            'Table {0} matches more than one regexp in config, '
                            'skipping this match: "{1}"'.format(
                                table_instance.table_name, key_name))
                    else:
                        table_names.add(
                            (
                                table_instance.table_name,
                                key_name
                            ))
                        not_used_tables.discard(key_name)
                else:
                    logger.debug(
                        "Table {0} did not match with config key {1}".format(
                            table_instance.table_name, key_name))
            except re.error:
                logger.error('Invalid regular expression: "{0}"'.format(
                    key_name))
                sys.exit(1)

    if not_used_tables:
        logger.warning(
            'No tables matching the following configured '
            'tables found: {0}'.format(', '.join(not_used_tables)))

    return sorted(table_names)
783522
String getTableName() {
        if (opType == OpTypes.MULTICOLUMN) {
            return tableName;
        }

        if (opType == OpTypes.COLUMN) {
            if (rangeVariable == null) {
                return tableName;
            }
            return rangeVariable.getTable().getName().name;
        }
        return "";
    }
1362155
def get_table(self, tablename):
        
        table, (_row, _col) = self.__tables[tablename]
        return table
905221
def lookupChdbid( tableName, dbid=nil )
      getSchema(dbid) if dbid
      unmodifiedTableName = tableName.dup
      @chdbid = findElementByAttributeValue( @chdbids, "name", formatChdbidName( tableName ) )
      if @chdbid
         @dbid = @chdbid.text
         return @dbid
      end
      if @chdbids
         chdbidArray = findElementsByAttributeName( @chdbids, "name" )
         chdbidArray.each{ |chdbid|
            if chdbid.has_text?
               dbid = chdbid.text
               getSchema( dbid )
               name = getResponseElement( "table/name" )
               if name and name.has_text? and name.text.downcase == unmodifiedTableName.downcase
                  @chdbid = chdbid
                  @dbid = dbid
                  return @dbid
               end
            end
         }
      end
      nil
   end
735581
function key() {
	var hashName = _.result( this, 'hashAttribute' ) || _.result( this, 'idAttribute' ),
		rangeNake = _.result( this, 'rangeAttribute' );

	return this.pick( hashName, rangeNake );
}
501549
def getsubtables(self):
        """"""
        keyset = self.getkeywords()
        names = []
        for key, value in keyset.items():
            if isinstance(value, str) and value.find('Table: ') == 0:
                names.append(_do_remove_prefix(value))
        return names
880338
private Object[] findIdsByColumn(String tableName, String columnName, Object columnValue)
    {
        Object connection = null;

        try
        {
            connection = getConnection();
            String valueAsStr = PropertyAccessorHelper.getString(columnValue);

            Set<String> results = null;

            if (resource != null && resource.isActive())
            {
                Response response = ((Transaction) connection).zrangeByScore(getHashKey(tableName, columnName),
                        getDouble(valueAsStr), getDouble(valueAsStr));
                // ((Transaction) connection).exec();
                ((RedisTransaction) resource).onExecute(((Transaction) connection));

                results = (Set<String>) response.get();
            }
            else
            {
                results = ((Jedis) connection).zrangeByScore(getHashKey(tableName, columnName), getDouble(valueAsStr),
                        getDouble(valueAsStr));

            }
            if (results != null)
            {
                return results.toArray(new Object[0]);
            }

        }
        finally
        {
            onCleanup(connection);
        }

        return null;
    }