from pycen import con_gn sql = ''' CREATE OR REPLACE VIEW gn_exports.v_bam_widget AS SELECT t.cd_ref AS cd_ref, t.nom_vern AS nom_vernaculaire, t.lb_nom AS nom_scientifique, s.id_synthese AS id_synthese, s.date_min AS date_min, s.date_max AS date_max, s.the_geom_4326 AS the_geom_4326, t.classe AS classe FROM gn_synthese.synthese s JOIN taxonomie.taxref t USING(cd_nom) ; ''' with con_gn.begin() as cnx: cnx.execute(sql)