Skip to content

Tag: join

Django join tables with ForeignKey

I’m trying to join 3 tables with ForeignKey but it returns Null values. I’m using select related and also I tried Insight.objects.all() but both are not working. Here are my models: My View: Answer I solved my problem by the below, I could update the DB with the result of the below query

How to filter after two joins in flask SQL alchemy

I have the following 3 tables: Each sample has a chain of processes it goes through and I need to get a table which includes both and the latest date it has encountered a process, so that I can filter by this date. Something like this What I tried so far was looking at this and similar solutions: