First, Merry Christmas.
Since I still experiencing problem on left join I have looked more
deeply and try to find where is the difference between old and new
DAL.
I found that my problem only appears on a more complex request:
Domain = dbPsnol.domain
Client = dbPsnol.client
Contact = dbPsnol.contact
Manager = dbPsnol.contact.with_alias('manager')
Datacenter = dbPsnol.datacenter
PsnVersion = dbPsnol.psn_version
Server = dbPsnol.server
query = dbPsnol((Domain.id==request.args[0])&
(Client.id==Domain.client_id)&
(Datacenter.id==Domain.dc_id)&
(PsnVersion.id==Domain.psn_version_id))
sql = query._select(Domain.name, Client.name,
Manager.name, left=[
Manager.on(Manager.id==Client.manager_id)])
print sql
With the old DAL:
SELECT
domain.name,
client.name,
manager.name FROM datacenter, domain,
psn_version, client LEFT JOIN contact AS manager ON
manager.id=client.manager_id WHERE (((
domain.id=211 AND
psn_version.id=domain.psn_version_id) AND
datacenter.id=domain.dc_id)
AND
client.id=domain.client_id);
With the new DAL:
SELECT
domain.name,
client.name,
manager.name FROM datacenter,
domain, client, psn_version LEFT JOIN contact AS manager ON
(
manager.id = client.manager_id) WHERE ((((
domain.id = 211) AND
(
psn_version.id = domain.psn_version_id)) AND (
datacenter.id =
domain.dc_id)) AND (
client.id = domain.client_id));
The difference is almost invisible, but tables client and psn_version
have swap in the FROM part of the request. It seems that my problem
come from there since the new DAL syntax isn't correct for PostgreSQL.
For my second problem (INNER JOIN and alias) I will open a new ticket
quickly. Many thanks for your work.