我正在尝试将这个“简单”的 SQL 语句映射到 SQL-Alchemy
select DISTINCT cv.*, ct."name"
from "CarVariants" cv,
"Cars" ca,
"CarTypes" ct
where cv."f_keyNumber" = ca."keyNumber"
and cv."carType" = ca."carType"
and cv."carType" = ct."f_carType"
and "f_keyNumber" = '12345'
and "f_carId" = 1
像这样的东西:
variants = self.em.CarVariants.createQuery();
variants = variants.filter_by(f_keyNumber=12345, f_carId = 1).distinct()
如何添加“和”关系(汽车、汽车类型)?