I'm using sqlalchemy in a FastAPI app with pydantic models.
I'm confused why the grouped results includes a result row for NULL for some Clients even though table-wide there's no record with a NULL status. The status field is an enum with only string options.
status: Status = Field(
sa_column=Column(Enum(Status)),
default=Status.pending.value,
)
query1 = db.query(VehicleDB).filter(VehicleDB.status == None).all() # -> []
query2 = db.query(ClientDB.name, VehicleDB.status, total)
.outerjoin(VehicleDB)
.group_by(ClientDB.name, VehicleDB.status).all()
-> [('Client1', None, 0)
...