HasKeys
This class provides a lookup operator for PostgreSQL fields to determine if a collection contains a specific set of keys. It maps to the PostgreSQL "?&" operator and ensures that the right-hand side values are processed as a list of strings during the lookup preparation.
Attributes
| Attribute | Type | Description |
|---|---|---|
| lookup_name | string = has_keys | The identifier used in Django ORM queries to invoke this specific lookup, set to "has_keys". |
| postgres_operator | string = ?& | The specific PostgreSQL operator used in the generated SQL to check if all specified keys exist in a JSONB column. |
Constructor
Signature
def HasKeys()
Methods
get_prep_lookup()
@classmethod
def get_prep_lookup() - > list
Prepares the right-hand side values for the database query by converting each item in the collection to its string representation.
Returns
| Type | Description |
|---|---|
list | A list of strings representing the keys to be checked for existence within the JSONB field. |