this method completes the keys list in a key-value schema in the format table.keyName
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
841862
private List fetchColumn(String columnName, Object connection, List results, Set<String> resultKeys)
    {
        for (String hashKey : resultKeys)
        {
            List columnValues = null;
            if (resource != null && resource.isActive())
            {
                Response response = ((Transaction) connection).hmget(hashKey, columnName);
                // ((Transaction) connection).exec();
                ((RedisTransaction) resource).onExecute(((Transaction) connection));

                columnValues = (List) response.get();
            }
            else
            {
                columnValues = ((Jedis) connection).hmget(hashKey, columnName);
            }

            if (columnValues != null && !columnValues.isEmpty())
            {
                results.addAll(columnValues); // Currently returning list of
                                              // string as known issue
                                              // with
                                              // joint table concept!
            }

        }

        return results;
    }
771254
final List<DBColumn> getPrimaryKeyColumnList() {

		final List<DBColumn> primaryKeyColumnList = new ArrayList<DBColumn>();

		final Set<String> columnNameSet = getAllColumnNames();

		for (String columnName : columnNameSet) {

			final D6ModelClassFieldInfo fieldInfo = getFieldInfo(columnName);

			final Field field = fieldInfo.field;

			final DBColumn dbColumn = field.getAnnotation(DBColumn.class);

			if (dbColumn.isPrimaryKey()) {

				primaryKeyColumnList.add(dbColumn);
			}
		}

		return primaryKeyColumnList;
	}
1275090
def _get_final_set(self, sets, pk, sort_options):
        
        conn = self.cls.get_connection()
        all_sets = set()
        tmp_keys = set()

        if pk is not None and not sets and not (sort_options and sort_options.get('get')):
            # no final set if only a pk without values to retrieve
            return (None, False)

        elif sets or pk:
            if sets:
                new_sets, new_tmp_keys = self._prepare_sets(sets)
                all_sets.update(new_sets)
                tmp_keys.update(new_tmp_keys)
            if pk is not None:
                # create a set with the pk to do intersection (and to pass it to
                # the store command to retrieve values if needed)
                tmp_key = self._unique_key()
                conn.sadd(tmp_key, pk)
                all_sets.add(tmp_key)
                tmp_keys.add(tmp_key)

        else:
            # no sets or pk, use the whole collection instead
            all_sets.add(self.cls.get_field('pk').collection_key)

        if not all_sets:
            delete_set_later = False
            final_set = None
        elif len(all_sets) == 1:
            # if we have only one set, we  delete the set after calling
            # collection only if it's a temporary one, and we do not delete
            # it right now
            final_set = all_sets.pop()
            if final_set in tmp_keys:
                delete_set_later = True
                tmp_keys.remove(final_set)
            else:
                delete_set_later = False
        else:
            # more than one set, do an intersection on all of them in a new key
            # that will must be deleted once the collection is called.
            delete_set_later = True
            final_set = self._combine_sets(all_sets, self._unique_key())

        if tmp_keys:
            conn.delete(*tmp_keys)

        # return the final set to work on, and a flag if we later need to delete it
        return (final_set, [final_set] if delete_set_later else None)
1359686
def to_h
      keys.map { |k| [k, map { |h| h[k] }] }.to_h
    end
1185200
def get_pk_colnames(table_: Table) -> List[str]:
    
    pk_names = []  # type: List[str]
    for col in table_.columns:
        if col.primary_key:
            pk_names.append(col.name)
    return pk_names
688163
def complete_keyword
      keywords = []
      definition.fields.each do|f|
        next unless f[1].complete_enabled
        if (f[1].key_field)
          keywords += complete_key(f[0], f[1], tokens.last)
        else
          keywords << f[0].to_s + ' '
        end
      end
      keywords.sort
    end
160586
def schema_complete():
        """"""
        return Schema({
            'stage': And(str, len),
            'timestamp': int,
            'status': And(str, lambda s: s in ['started', 'succeeded', 'failed']),
            # optional matrix
            Optional('matrix', default='default'): And(str, len),
            # optional information
            Optional('information', default={}): {
                Optional(Regex(r'([a-z][_a-z]*)')): object
            }
        })
706749
def mdel(keys)
      validate_key_array(keys)

      encapsulate_error do
        GitHub::SQL.run(<<-SQL, :keys => keys, :connection => connection)
          DELETE FROM key_values WHERE `key` IN :keys
        SQL
      end

      nil
    end
466635
def key_list(items=None):
    '''
    
    '''
    if items is None:
        items = []

    ret = {}
    if items and isinstance(items, list):
        for item in items:
            if 'name' in item:
                # added for consistency with old code
                if 'id' not in item:
                    item['id'] = item['name']
                ret[item['name']] = item
    return ret
922043
@Override
    public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException
    {
        checkClosed();
        VoltTable vtable = new VoltTable(
                new ColumnInfo("PKTABLE_CAT", VoltType.STRING),
                new ColumnInfo("PKTABLE_SCHEM", VoltType.STRING),
                new ColumnInfo("PKTABLE_NAME", VoltType.STRING),
                new ColumnInfo("PKCOLUMN_NAME", VoltType.STRING),
                new ColumnInfo("FKTABLE_CAT", VoltType.STRING),
                new ColumnInfo("FKTABLE_SCHEM", VoltType.STRING),
                new ColumnInfo("FKTABLE_NAME", VoltType.STRING),
                new ColumnInfo("FKCOLUMN_NAME", VoltType.STRING),
                new ColumnInfo("KEY_SEQ", VoltType.SMALLINT),
                new ColumnInfo("UPDATE_RULE", VoltType.SMALLINT),
                new ColumnInfo("DELETE_RULE", VoltType.SMALLINT),
                new ColumnInfo("FK_NAME", VoltType.STRING),
                new ColumnInfo("PK_NAME", VoltType.STRING),
                new ColumnInfo("DEFERRABILITY", VoltType.SMALLINT)
        );
        //NB: @SystemCatalog(?) will need additional support if we want to
        // populate the table.
        JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable);
        return res;
    }
1058516
def create_key_for_data(prefix, data, key_params):
    
    d = data.get_data()
    values = []
    for k in key_params:
        if k in d and type(d[k]) is list:
            values.append("{0}:{1}".format(k, " -".join(d[k])))
        else:
            value = d[k] if k in d else ''
            values.append("{0}:{1}".format(k, value))

    return "{0}-{1}".format(prefix, "-".join(values))
1067027
def key_values_cache_key_name(cls, *key_fields):
        
        key_fields = key_fields or cls.KEY_FIELDS
        return 'configuration/{}/key_values/{}'.format(cls.__name__, ','.join(key_fields))
618371
def keytechKeyValueObject
      arrayOfKeyValuePairs = []
      keyValueList.each do |key, value|
        arrayOfKeyValuePairs.push ({ Key: key, Value: value })
      end
      arrayOfKeyValuePairs
    end
771210
def get_all_keys(self, headers=None, **params):
        
        key = Key(self.name, self.contained_key)
        return SimpleResultSet([key])
927684
def column_keymap(self):
        
        keystates = set()

        shortcuts = self.cp.items('column_keymap')
        keymap_dict = dict(shortcuts)

        for combo, action in shortcuts:
            # add all possible prefixes to keystates
            combo_as_list = re.split('(<[A-Z].+?>|.)', combo)[1::2]
            if len(combo_as_list) > 1:
                keystates |= set(accumulate(combo_as_list[:-1]))

            if action in ['pri', 'postpone', 'postpone_s']:
                keystates.add(combo)

            if action == 'pri':
                for c in ascii_lowercase:
                    keymap_dict[combo + c] = 'cmd pri {} ' + c

        return (keymap_dict, keystates)
766480
protected String[] getKeysFromResultSet()
            throws SQLException {

        String[] keys = super.getKeysFromResultSet();

        // check schemaProperty mapping names for more accurate column->field mapping
        SchemaProperty[] props = _schemaType.getElementProperties();
        for (int i = 0; i < props.length; i++) {

            int col = -1;
            try {
                col = _resultSet.findColumn(props[i].getName().getLocalPart());
            } catch (SQLException x) {
            }

            if (col > 0) {
                keys[col] = props[i].getJavaPropertyName().toUpperCase();
            }
        }
        return keys;
    }