我有以下 sql 脚本。
SELECT *
FROM movies
LEFT JOIN possession
ON movies.id = possession.movie_id
AND possession.master_id = ?
WHERE possession.id is NULL
ORDER BY movies.id DESC
并需要帮助在 sqlalchemy 中进行说明。请问有人可以帮我吗?
以下不起作用:
movies = movie.Movie.query.join(possession.Possession, movie.Movie.id == possession.Possession.movie_id)\
.filter(possession.Possession.master_id == session.get('userId'))\
.filter(not_(possession.Possession.id)).order_by(movie.Movie.id.desc()).all()
非常感谢!
干杯