Hello list,

Any idea how I could generate this SQL statement under SQLAlchemy 
(especially the PostreSQL ARRAY clause ...) ?

SELECT   
    i.id,
    t.name AS taxo,
    i.geographic_range,
    ARRAY(
        (SELECT h.name
         FROM habitats h, invasive_habitats ih
         WHERE h.id=ih.habitat_id AND ih.invasive_id=i.id)
        ) AS habitats,
    (SELECT
        ivn.name
     FROM invasive_names ivn, languages l
     WHERE
        ivn.language_id=l.id AND
        l.iso_code='la' AND
        ivn.invasive_id=i.id
    ) AS scientific_name
FROM invasives i, taxonomies t
WHERE t.id=i.group_id
ORDER BY i.id;

Thanks,
Julien

-- 
Julien Cigar
Belgian Biodiversity Platform
http://www.biodiversity.be
Université Libre de Bruxelles
Campus de la Plaine CP 257
Bâtiment NO, Bureau 4 N4 115C (Niveau 4)
Boulevard du Triomphe, entrée ULB 2
B-1050 Bruxelles
office: [EMAIL PROTECTED]
home: [EMAIL PROTECTED]


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to