0
select d.field_value as name,a.mobile,c.balance,a.created_at from users as a inner join user_profiles as b on a.id = b.user_id
inner join wallets as c on c.user_profile_id = b.id
left join profile_details as d on d.user_id = a.id where d.field_name = "name" and c.balance > 0 order by a.id desc;

This is my query and i need to write in sqlalchemy, i have model with all mentioned tables and proper columns. Thanks for yours all efforts and time spent here.

Chris
  • 18,724
  • 6
  • 46
  • 80

1 Answers1

0

It's pretty easy. I've some links to be referred.

You can refer to the documentation here.

How to join multiple tables here.

How to select only few columns from the query here.

Left and/or right outer join using sqlalchemy here

I think now you may be able to solve your problem. Hope this helps.

Bhavesh Achhada
  • 101
  • 1
  • 9