Paul McNett wrote:
> Revision 5180:
> ------------------------------------------------------------------------
> r5180 | ed | 2009-04-18 06:55:13 -0700 (Sat, 18 Apr 2009) | 2 lines
> Changed paths:
> M /trunk/dabo/biz/dBizobj.py
> M /trunk/dabo/db/dCursorMixin.py
>
> Revamped the code for determining the alias used in a child filter.
> Previously the bizobj's DataSource was used, which incorrectly assumed
> that that would be the correct alias. This addresses the issue (Trac
> #1228) raised by Sibylle Koczian.
>
> ------------------------------------------------------------------------
>
> Causes the following traceback in my app:
>
> Traceback (most recent call last):
> File "sbs_studio.py", line 162, in <module>
> main()
> File "sbs_studio.py", line 137, in main
> hasValidCustomers = app.hasValidCustomers()
> File
> "/home/pmcnett/py/sbs/shutter_studio/trunk/clients/shutter_studio/App.py",
> line 808, in hasValidCustomers
> biz.requery()
> File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 905,
> in requery
> self.requeryAllChildren()
> File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 1433,
> in requeryAllChildren
> child.requery()
> File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 886,
> in requery
> cursor.requery(params)
> File "/home/pmcnett/dabo-full/trunk/dabo/db/dCursorMixin.py", line
> 434, in requery
> self.execute(currSQL, params, _newQuery=newQuery)
> File "/home/pmcnett/dabo-full/trunk/dabo/db/dCursorMixin.py", line
> 329, in execute
> raise dException.DBQueryException(errMsg, sql)
> dabo.dException.DBQueryException: no such column: prod_cust.cust_id.cust_id
> SQL: select prod_cust.id as id,
> prod_cust.prod_id as prod_id,
> prod_cust.cust_id as cust_id,
> prod_cust.sf_price as sf_price,
> prod_cust.is_default as is_default,
> prod_cust.notes as notes,
> product_lines.name as product_line_name,
> product_lines.sf_price as default_sf_price,
> customers.account as customer_account,
> customers.name as customer_name
> from prod_cust
> left join product_lines
> on product_lines.id = prod_cust.prod_id
> left join customers
> on customers.id = prod_cust.cust_id
> where prod_cust.cust_id.cust_id =
> 'b71c418a-a04e-40fa-a534-5283e0998ca3'
> group by prod_cust.id
> limit 2000
>
> It should be 'prod_cust.cust_id' and not 'prod_cust.cust_id.cust_id'.
I think what is happening is that I'm constructing the SQL from clause
as follows:
111 self.setFromClause("""prod_cust
112 left join product_lines
113 on product_lines.id = prod_cust.prod_id
114 left join customers
115 on customers.id = prod_cust.cust_id""")
The new code in setChildFilter() seems to assume (by using split()[-1])
that the last word in the from clause is going to be the table alias,
but in my case the last 'word' is 'prod_cust.cust_id'.
My code above was written prior to dabo having addJoin() and I could
certainly rewrite it, but I really don't want to have to if it can be
avoided (there are many bizobjs written this way).
Thanks
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]