I resolved this issue. Choosing a different mapper class as first arg
of the relation() call solved this issue and everything is working
perfectly.

-aj

--On 26. April 2007 08:44:22 +0200 Andreas Jung <[EMAIL PROTECTED]> wrote:



--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




--
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376
Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535
Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting

Attachment: pgp2hi1Wsuan6.pgp
Description: PGP signature

Reply via email to