Not sure what is going on here. The code that I posted above generates the
following SQL which does not make sense
SELECT risks.id, risks.title, risks.status, risks.description, risks.
event_description, risks.cause_description, risks.result_description, risks.
team, risks.user, risks.risk_owner, risks.date_added, risks.csr_impacted,risks
.id_review_meeting, risks.id_platform, risks.id_contract,
risks.id_supplier,risks
.csr_reference, risks.maximum_cost FROM suppliers, risks JOIN suppliers AS
id_supplier ON (suppliers.id = risks.id_supplier) WHERE (risks.id IS NOT
NULL);
There is no mention of the users, teams, contracts or platforms tables.
However when I run the code for real i.e. without the _select it does fetch
fields from these tables but as I say it duplicates each record 5 times,
once for each table in the query.
Since I am using gluon with PyQt rather than web2py I am not able to
provide a working app for you.
On Wednesday, 10 July 2013 15:32:40 UTC+1, Niphlod wrote:
>
> check the _select() to see what's going on. if you think the generated SQL
> is wrong, pack a MINIMAL app with test database records to show what you
> want to achieve with what you are starting from.
>
>
>
> Il giorno mercoledì 10 luglio 2013 15:22:00 UTC+2, Simon Carr ha scritto:
>>
>> The following code duplicate records based on the number of tables
>> referenced using with_alias. You see below that I have a reference to 5
>> tables which is resulting in every record being duplicated 5 times. If I
>> make a reference to a sixth table I get every record duplicated 6 times.
>>
>> Anu idwhat is going wrong.
>>
>> RSRisks = db(
>> (db.risks.user == userid)&
>> (db.risks.status == status)
>> ).select(
>> join = [db.teams.with_alias('team').on(db.teams.id == db.
>> risks.team).
>> db.users.with_alias('user').on(db.users.id == db.
>> risks.user).
>> db.users.with_alias('risk_owner').on(db.users.id
>> == db.risks.risk_owner).
>> db.platforms.with_alias('id_platform').on(db.
>> platforms.id == db.risks.id_platform).
>> db.contracts.with_alias('id_contract').on(db.
>> contracts.id == db.risks.id_contract).
>> db.suppliers.with_alias('id_supplier').on(db.
>> suppliers.id == db.risks.id_supplier)
>> ]
>> )
>>
>> Is this is a bug in gluon? or have I done something wrong in this code?
>>
>> Thanks
>> So,pm
>>
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.