Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gqlalchemy/query_builders/declarative_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class Operator(Enum):
LEQ_THAN = "<="
NOT_EQUAL = "!="
INCREMENT = "+="
IS_NOT_NULL = "IS NOT NULL"
SIMILAR = "=~"


Expand Down Expand Up @@ -185,6 +186,10 @@ def _build_where_query(self, item: str, operator: Operator, **kwargs) -> "Declar
if operator_str not in Operator._value2member_map_:
raise GQLAlchemyOperatorTypeError(clause=self.type)

# Unary operators (e.g., IS NOT NULL) don't require a literal or expression

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Unary operators (e.g., IS NOT NULL) don't require a literal or expression

if operator_str == Operator.IS_NOT_NULL.value:
return f"{item} {operator_str}"

if value is None:
if literal is None:
raise GQLAlchemyLiteralAndExpressionMissing(clause=self.type)
Expand Down