python - RIGHT OUTER JOIN in SQLAlchemy -


I have two tables Beard and mustache is defined as follows: < / P>

  + -------- + --------- + ------------ + -------- ------ + | Person Beard Beard style | Beard length + -------- + --------- + ------------ + ------------- + + - - ----- + ------------- + ---------------- + | Person Mostaked | Miststyle | + -------- + ------------- + ---------------- +   < P> I have created a SQL query in PostgreSQL, which would will combine these two tables and generates the following results:  
  + -------- + ------- - + ------------ + ------------- + ------------- + ------ - -------- + | Person Beard Beard style | Beard length Mostaked | Miststyle | + -------- + --------- + ------------ + ------------- + --- ---------- + ---------------- + | Bob | 1 | Rutatin | 1 | | | + -------- + --------- + ------------ + ------------- + --- ---------- + ---------------- + | Bob | 2 | Samson | 12 | | | + -------- + --------- + ------------ + ------------- + --- ---------- + ---------------- + | Bob | | | | 1 | Fu Manchu | + -------- + --------- + ------------ + ------------- + --- ---------- + ---------------- +   

query: (false) select the upper seals beard encounters (false) where the person = "Bob" Unias select all * stop b and out of the mouth of the beards (false) where the person = "Bob"

However I can not represent SQLLame about it. I can from_statement and exclusion tried many ways to implement but none of them did not actually work there to help me with it?

I have come with this snippet:

  q1 = Session. \ Query (beard. Pirs. Label ( 'person'), Dadhikbiaidiaidi. Elelbiel ( 'Biyrdiaidi'), shave. Beyrstail. Label ( "beard style"), Sclalikmi SQL. Tap (). Label ( 'Muscad') , Skelechme. Sql.null (). Label ('Mustest Style'),). Filter (beard viewer == 'Bob') q2 = session. Labeled ('beardID'), sqlalchemy.sql.null (). Label ('beardStyle'), Mostach.Mostach, Mostach.Most: Style, ). Filter (Moustache.person == 'bob') Results = q1.union (q2) .all ()   

Although this works but you do not call it as an answer Because it appears a hack is another reason why the should be in the right outer join sqlalchemy

Comments