--On 25. April 2007 07:13:19 -0400 Michael Bayer <[EMAIL PROTECTED]> wrote:

well i just noticed youre sticking an external table into your
primaryjoin....but i see nothing there that implies the usage of a
LEFT OUTER JOIN ?  are you saying that you dont need the rows from
AMH_View to be present ? how could SA possibly know that ?  (if not,
please send me the exact query being produced, and the exact query
you think should be produced)

My first posting contains all the informations:

The mapper code is:

   class HierarchyNode(MappedClassBase):
        pass


   mapper(HierarchyNode, HierarchyTable, properties={

......omitting the code for the self-referential table...

       'tools' : relation(
                       HierarchyNode,
primaryjoin=AMH_View.c.idhierarchy==HierarchyTable.c.id,
                       foreign_keys=[AMH_View.c.idhierarchy],
                       uselist=True,
                    ),
       }
   )

Using 'tools' I am trying to obtain all rows from AMH_View
whose 'idhierarchy' col match the 'id' value of the 'current'
Hierarchy row.

SA generates:

select .... from hierarchy, arbeitsmittelhierarchy_arbeitsmittel_view
where arbeitsmittelhierarchy_arbeitsmittel_view  = some_id


I would expect something like


select ...from hierarchy H left join arbeitsmittelheirarchy_arbeitsmittel_view AMH on AMH.idhierarchy = H.id
where H.id = <current id>

Andreas

Attachment: pgpglXzX3XZZ4.pgp
Description: PGP signature

Reply via email to