I am trying to join multiple tables in Sqlalchemy and pass the result
to JqGrid. I have one table working well but need to add more tables
to display descriptions instead of the pointer values in the base
table.

Root Controller code:

    @expose("json")
    def altgd_data(self, *args,  **kwargs):
        """Show form to Show Item_Alt jqgrid.columns    """
        global rdate
        log.debug(kwargs)
        log.debug(rdate)
        item_alts = DBSession.query(Item_alt).select_from(outerjoin
(Item_alt,Alert,Item_alt.bank_id == \
            Alert.bank_id and Item_alt.alert == Alert.alert_id))\
        .filter(Item_alt.bank_id == 1).filter(Item_alt.run_dt ==
rdate)
        records = item_alts.count()
        rows = 10
        page = str(1)
        total = records / rows
        if total < 1 :
            total = 1
        total = str(total)
        records = str(records)
        log.debug(records)
        rows = [{'cell': [str(item_alt.account), str
(item_alt.item_nm),
            item_alt.seq, str(item_alt.action), item_alt.act_dt,
item_alt.ckd_by, item_alt.sent_to, alert.sh_desc ]\
            ,'id':str(item_alt.id)} for item_alt in item_alts]
        log.debug(dict(page=page,records=records, total=total,
rows=rows, ))
        log.debug(kwargs)
        return dict(page=str(page), total=str(total),records=str
(records), rows=rows )

The Debug displays the values until the 'rows =' line. Adding the
'alert.sh_desc' field causes the code to fail.

How do I refer to the additional tables/fields in the 'FOR Loop'?

Any suggestions will be appreciated.
-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.


Reply via email to