I just stumbled upon this behaviour of sqlalchemy:
>>> from sqlalchemy import Column, null
>>> print(Column("x") == null())
x IS NULL
>>> print(Column("x") == None)
x IS NULL
>>> print(null() == Column("x"))
NULL = x
>>> print(None == Column("x"))
x IS NULL
Can someone explain why ==
is not commutative for null()
while it is when using None
? What's the purpose?