Compare commits

..

9 Commits
1.35 ... main

4 changed files with 137 additions and 29 deletions

View File

@ -120,7 +120,9 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.comboBox_2.currentIndexChanged.connect(self.bd_source) # Changement de base de données self.comboBox_2.currentIndexChanged.connect(self.bd_source) # Changement de base de données
self.checkBox.hide() self.checkBox.hide()
self.toolButton.clicked.connect(self.getCanevas) # Filtrer par emprise du canevas self.toolButton.clicked.connect(self.getCanevas) # Filtrer par emprise du canevas
self.toolButton.setToolTip('Filtrer uniquement les couche Contour/Habitat/Travaux \nqui ce trouve dans le canvas de la carte.')
self.toolButton_2.clicked.connect(self.filtre_favorit) # Filtrer par favoris self.toolButton_2.clicked.connect(self.filtre_favorit) # Filtrer par favoris
self.toolButton_2.setToolTip('Afficher uniquement les favoris.')
layout = QVBoxLayout() layout = QVBoxLayout()
self.lineEdit.textChanged.connect(self.filtre_dynamique) # Recherche dynamique self.lineEdit.textChanged.connect(self.filtre_dynamique) # Recherche dynamique
layout.addWidget(self.lineEdit) layout.addWidget(self.lineEdit)
@ -283,16 +285,20 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
if self.comboBox.currentText() == 'toutes les catégories': if self.comboBox.currentText() == 'toutes les catégories':
custom_list = schemaname_list custom_list = schemaname_list
elif self.comboBox.currentText() == 'travaux': elif self.comboBox.currentText() == 'travaux':
custom_list = """(SELECT schemaname,tablename from pg_catalog.pg_tables custom_list = schemaname_list[:-2] + """
where schemaname like '""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) UNION (SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews where schemaname like '""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) order by schemaname,tablename;""" WHERE schemaname LIKE '""" + str(self.comboBox.currentText()) + """%';
"""
else: else:
custom_list = """(SELECT schemaname,tablename from pg_catalog.pg_tables custom_list = schemaname_list[:-2] + """
where schemaname like '\\_""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) UNION (SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews where schemaname like '\\_""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) order by schemaname,tablename;""" WHERE schemaname LIKE '_""" + str(self.comboBox.currentText()) + """%';
"""
else: else:
if self.comboBox.currentText() == 'toutes les catégories': if self.comboBox.currentText() == 'toutes les catégories':
custom_list = schemaname_list_ref custom_list = schemaname_list_ref
else: else:
custom_list = """SELECT schemaname, tablename from pg_catalog.pg_tables WHERE schemaname LIKE '""" + str(self.comboBox.currentText()) + """' AND tablename NOT LIKE 'qgis_projects' order by schemaname, tablename;""" custom_list = schemaname_list_ref[:-2] + """
WHERE schemaname LIKE '""" + str(self.comboBox.currentText()) + """%' AND tablename NOT LIKE 'qgis_projects';
"""
cur.execute(custom_list) cur.execute(custom_list)
list_schema = cur.fetchall() list_schema = cur.fetchall()
@ -325,13 +331,36 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
list_projects_qgis.append(cur.fetchall()) list_projects_qgis.append(cur.fetchall())
# Récupération des droits d'accès de l'utilisateur sur les tables # Récupération des droits d'accès de l'utilisateur sur les tables
SQLGrands = """
WITH t as (SELECT
n.nspname AS table_schema,
c.relname AS table_name,
r.rolname AS grantee,
CASE
WHEN acl_text LIKE '%r%' THEN 'SELECT'
WHEN acl_text LIKE '%w%' THEN 'UPDATE'
WHEN acl_text LIKE '%a%' THEN 'INSERT'
WHEN acl_text LIKE '%d%' THEN 'DELETE'
WHEN acl_text LIKE '%x%' THEN 'REFERENCES'
ELSE 'OTHER'
END AS privilege_type
FROM pg_class c
JOIN pg_namespace n ON n.oid = c.relnamespace
LEFT JOIN LATERAL unnest(c.relacl) AS acl_item(acl) ON TRUE
LEFT JOIN LATERAL (
SELECT acl::text AS acl_text,
split_part(acl::text, '=', 1) AS grantee_name
) priv ON TRUE
LEFT JOIN pg_roles r ON r.rolname = priv.grantee_name
WHERE c.relkind IN ('r', 'v','m'))
"""
if self.comboBox.currentText() == 'toutes les catégories': if self.comboBox.currentText() == 'toutes les catégories':
SQLGrands = """SELECT concat(table_schema,'.',table_name) FROM information_schema.role_table_grants WHERE grantee in(SELECT rolname FROM pg_catalog.pg_roles WHERE oid in(SELECT roleid FROM pg_auth_members WHERE member = (SELECT usesysid FROM pg_catalog.pg_user WHERE usename = '""" + user + """'))) and privilege_type = 'SELECT';""" SQLGrands = SQLGrands + """SELECT concat(table_schema,'.',table_name) FROM t WHERE grantee in(SELECT rolname FROM pg_catalog.pg_roles WHERE oid in(SELECT roleid FROM pg_auth_members WHERE member = (SELECT usesysid FROM pg_catalog.pg_user WHERE usename = '""" + user + """'))) and privilege_type = 'SELECT';"""
else: else:
if dbtype == sigdb: if dbtype == sigdb:
SQLGrands = """SELECT concat(table_schema,'.',table_name) FROM information_schema.role_table_grants WHERE grantee in(SELECT rolname FROM pg_catalog.pg_roles WHERE oid in(SELECT roleid FROM pg_auth_members WHERE member = (SELECT usesysid FROM pg_catalog.pg_user WHERE usename = '""" + user + """'))) and privilege_type = 'SELECT' AND table_schema LIKE '_""" + str(self.comboBox.currentText()) + """_%';""" SQLGrands = SQLGrands + """SELECT concat(table_schema,'.',table_name) FROM t WHERE grantee in(SELECT rolname FROM pg_catalog.pg_roles WHERE oid in(SELECT roleid FROM pg_auth_members WHERE member = (SELECT usesysid FROM pg_catalog.pg_user WHERE usename = '""" + user + """'))) and privilege_type = 'SELECT' AND table_schema LIKE '_""" + str(self.comboBox.currentText()) + """_%';"""
elif dbtype == refdb: elif dbtype == refdb:
SQLGrands = """SELECT concat(table_schema,'.',table_name) FROM information_schema.role_table_grants WHERE grantee in(SELECT rolname FROM pg_catalog.pg_roles WHERE oid in(SELECT roleid FROM pg_auth_members WHERE member = (SELECT usesysid FROM pg_catalog.pg_user WHERE usename = '""" + user + """'))) and privilege_type = 'SELECT' AND table_schema LIKE '""" + str(self.comboBox.currentText()) + """%';""" SQLGrands = SQLGrands + """SELECT concat(table_schema,'.',table_name) FROM t WHERE grantee in(SELECT rolname FROM pg_catalog.pg_roles WHERE oid in(SELECT roleid FROM pg_auth_members WHERE member = (SELECT usesysid FROM pg_catalog.pg_user WHERE usename = '""" + user + """'))) and privilege_type = 'SELECT' AND table_schema LIKE '""" + str(self.comboBox.currentText()) + """%';"""
cur.execute(SQLGrands) cur.execute(SQLGrands)
list_grands = cur.fetchall() list_grands = cur.fetchall()
GrandUser = [] GrandUser = []
@ -359,6 +388,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.tableWidget.setColumnCount(5) self.tableWidget.setColumnCount(5)
i = 0 i = 0
for value in list_schema: for value in list_schema:
MetadataXML = value[2]
if dbtype == sigdb: if dbtype == sigdb:
type_val = str(value[0])[1:3] type_val = str(value[0])[1:3]
schema_name = str(value[0])[4:] schema_name = str(value[0])[4:]
@ -367,6 +397,8 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
table_name = str(value[1][len(value[0]) + 1:]) table_name = str(value[1][len(value[0]) + 1:])
else: else:
table_name = str(value[1]) table_name = str(value[1])
if type_val == "00":
table_name = value[1]
else: else:
type_val = '' type_val = ''
schema_name = str(value[0]) schema_name = str(value[0])
@ -421,8 +453,9 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.tableWidget.setCellWidget(i, 4, self.FavButton) self.tableWidget.setCellWidget(i, 4, self.FavButton)
# Coloration des lignes selon les droits d'accès # Coloration des lignes selon les droits d'accès
if (str(value[0]) + '.' + str(value[1])) in GrandUser: if (str(value[0]) + '.' + str(value[1])) in GrandUser: # L'utilisateur a les droits
pass # L'utilisateur a les droits for j in range(self.tableWidget.columnCount()):
self.tableWidget.item(i, j).setToolTip(MetadataXML)
else: else:
# Coloration en violet si droits insuffisants # Coloration en violet si droits insuffisants
for j in range(self.tableWidget.columnCount()): for j in range(self.tableWidget.columnCount()):
@ -573,7 +606,6 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
for row in range(0, self.tableWidget_2.rowCount()): for row in range(0, self.tableWidget_2.rowCount()):
color_rgba_db = 855030089 # Code couleur pour couche dans autre BD color_rgba_db = 855030089 # Code couleur pour couche dans autre BD
color_rgba_droit = 851150528 # Code couleur pour droits insuffisants color_rgba_droit = 851150528 # Code couleur pour droits insuffisants
print(self.tableWidget_2.item(row, 1).background().color().rgba())
if self.tableWidget_2.item(row, 1).background().color().rgba() == color_rgba_droit: if self.tableWidget_2.item(row, 1).background().color().rgba() == color_rgba_droit:
self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !", "Vous ne disposez pas des droit pour la couche «" + str(self.tableWidget_2.item(row, 1).text()) + ' ' + str(self.tableWidget_2.item(row, 2).text()) + "» !", QMessageBox.StandardButton(0x00004000)) self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !", "Vous ne disposez pas des droit pour la couche «" + str(self.tableWidget_2.item(row, 1).text()) + ' ' + str(self.tableWidget_2.item(row, 2).text()) + "» !", QMessageBox.StandardButton(0x00004000))
elif self.tableWidget_2.item(row, 1).background().color().rgba() != color_rgba_db: elif self.tableWidget_2.item(row, 1).background().color().rgba() != color_rgba_db:
@ -608,7 +640,6 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
elif code == 'qgis': elif code == 'qgis':
# Chargement d'un projet QGIS stocké dans la base de données # Chargement d'un projet QGIS stocké dans la base de données
schema = self.tableWidget_2.item(row, 2).text() schema = self.tableWidget_2.item(row, 2).text()
print(schema)
table = self.tableWidget_2.item(row, 3).text() table = self.tableWidget_2.item(row, 3).text()
uri_project = 'postgresql://' + user + ':' + mdp + '@' + host + ':' + port + '?sslmode=disable&dbname=' + dbtype + "&schema=" + schema + '&project=' + table uri_project = 'postgresql://' + user + ':' + mdp + '@' + host + ':' + port + '?sslmode=disable&dbname=' + dbtype + "&schema=" + schema + '&project=' + table
QgsProject.instance().read(uri_project) QgsProject.instance().read(uri_project)
@ -716,6 +747,22 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
def getCanevas(self): def getCanevas(self):
"""Filtre les couches selon l'emprise du canevas QGIS actuel""" """Filtre les couches selon l'emprise du canevas QGIS actuel"""
# Récupération de la liste des favoris de l'utilisateur
SQLFavTable = "SELECT concat(schema_name, '.', table_name) FROM admin_sig.favtable WHERE utilisateur LIKE '" + user + "';"
if dbtype == refdb:
conSIG = psycopg2.connect("host=" + host + " port=" + port + " dbname=" + sigdb + " user=" + user + " password=" + mdp)
curSIG = conSIG.cursor(cursor_factory=psycopg2.extras.DictCursor)
curSIG.execute(SQLFavTable)
list_fav = curSIG.fetchall()
conSIG.close()
else:
cur.execute(SQLFavTable)
list_fav = cur.fetchall()
FavList = []
for favFind in list_fav:
FavList.append(favFind[0])
# Récupération de l'emprise du canevas # Récupération de l'emprise du canevas
poly = iface.mapCanvas().extent() poly = iface.mapCanvas().extent()
geom = (str(poly.xMinimum()) + ',' + str(poly.yMinimum()) + ',' + str(poly.xMaximum()) + ',' + str(poly.yMaximum())) geom = (str(poly.xMinimum()) + ',' + str(poly.yMinimum()) + ',' + str(poly.xMaximum()) + ',' + str(poly.yMaximum()))
@ -748,13 +795,28 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
TableSomme = cur.fetchall()[0][0] TableSomme = cur.fetchall()[0][0]
if e[0][1:3] != 'fo': if e[0][1:3] != 'fo':
schema_name = e[0][4:]
DepName = QTableWidgetItem(e[0][1:3]) DepName = QTableWidgetItem(e[0][1:3])
SchemaName = QTableWidgetItem(e[0][4:]) SchemaName = QTableWidgetItem(schema_name)
else: else:
schema_name = e[0][6:]
DepName = QTableWidgetItem('form') DepName = QTableWidgetItem('form')
SchemaName = QTableWidgetItem(e[0][6:]) SchemaName = QTableWidgetItem(schema_name)
TableName = QTableWidgetItem(e[1][len(e[0]) + 1:]) table_name = e[1][len(e[0]) + 1:]
FavoritStatut = QTableWidgetItem('FavIcon') TableName = QTableWidgetItem(table_name)
FavStatut = 0
if (schema_name + '.' + table_name) not in FavList:
FAV = "mStarIconAdd.png"
FavStatut = 0
else:
FAV = "mStarIconDel.png"
FavStatut = 1
iconFav = QIcon()
iconFav.addPixmap(QtGui.QPixmap(resources_path('icons', FAV)), QIcon.Mode(0), QIcon.State(1))
self.FavButton = QPushButton(iconFav, "")
self.FavButton.clicked.connect(self.AddOrDelToUserFav)
self.tableWidget.insertRow(row_count) self.tableWidget.insertRow(row_count)
itemIcon = QTableWidgetItem() itemIcon = QTableWidgetItem()
@ -766,7 +828,9 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.tableWidget.setItem(row_count, 1, DepName) self.tableWidget.setItem(row_count, 1, DepName)
self.tableWidget.setItem(row_count, 2, SchemaName) self.tableWidget.setItem(row_count, 2, SchemaName)
self.tableWidget.setItem(row_count, 3, TableName) self.tableWidget.setItem(row_count, 3, TableName)
self.tableWidget.setItem(row_count, 3, FavoritStatut) item = QTableWidgetItem(str(FavStatut))
self.tableWidget.setItem(row_count, 4, item)
self.tableWidget.setCellWidget(row_count, 4, self.FavButton)
if TableSomme == 0: if TableSomme == 0:
for j in range(self.tableWidget.columnCount()): for j in range(self.tableWidget.columnCount()):
self.tableWidget.item(row_count, j).setBackground(QtGui.QColor(246, 185, 73, 50)) self.tableWidget.item(row_count, j).setBackground(QtGui.QColor(246, 185, 73, 50))

View File

@ -7,7 +7,7 @@ name=CenRa_FLUX
qgisMinimumVersion=3.0 qgisMinimumVersion=3.0
supportsQt6=True supportsQt6=True
description=Permet d'ouvrire une table dans la base PostGis description=Permet d'ouvrire une table dans la base PostGis
version=3.16 version=3.20
author=Conservatoire d'Espaces Naturels de Rhône-Alpes author=Conservatoire d'Espaces Naturels de Rhône-Alpes
email=si_besoin@cen-rhonealpes.fr email=si_besoin@cen-rhonealpes.fr
@ -32,7 +32,7 @@ icon=icon.png
# experimental flag # experimental flag
experimental=False experimental=False
changelog=<h2>CenRa_FLUX:</h2></br><p><h3>11/02/2026 - Version 3.16: </h3> - Creation de favori et visualisation.</p></br><p><h3>10/02/2026 - Version 3.15: </h3> - Sauvegarde la recherche.</p></br><p><h3>08/12/2025 - Version 3.14: </h3> - message d'erreur pour les drois de couche sur la DB.</p></br><p><h3>08/12/2025 - Version 3.13: </h3> - Detection des droit utilisateur.</p></br><p><h3>25/09/2025 - Version 3.12: </h3> - version +1.</p></br><p><h3>25/09/2025 - Version 3.11: </h3> - Correctife sur les code 00.</p></br><p><h3>24/09/2025 - Version 3.10: </h3> - Erreur sur l ouverture des couche raster. </p></br><p><h3>24/09/2025 - Version 3.9: </h3> - bugfix lier aux extention pgsql.</p></br><p><h3>09/09/2025 - Version 3.8: </h3> - Bug REF fix.</p></br><p><h3>05/09/2025 - Version 3.7: </h3> - Ouverture de projet QGIS contenue dans la base de donnees.</p></br><p><h3>30/07/2025 - Version 3.6: </h3> - Correctife de bug.</p></br><p><h3>29/07/2025 - Version 3.5: </h3> - Bug fix sur les donnee raster.</p></br><p><h3>23/07/2025 - Version 3.4: </h3> - Ouverture raster dans la base SIG.</p></br><p><h3>23/07/2025 - Version 3.3: </h3> - Optimisation des chargement.</p></br><p><h3>22/07/2025 - Version 3.2: </h3> - Visualisation des format raster et vecteur dans REF.</p></br><p><h3>21/07/2025 - Version 3.1: </h3> - Bug fix pour l'ouverture de plus de 5 couches.</p></br><p><h3>19/05/2025 - Version 3.0: </h3> - Compatible PyQt5 et PyQt6.</p></br><p><h3>09/04/2025 - Version 2.9: </h3> - Correctif bug en TT.</p></br><p><h3>09/04/2025 - Version 2.8: </h3> - Optimisation pour le TT.</p></br><p><h3>07/04/2025 - Version 2.7: </h3> - mode debug.</p></br><p><h3>03/04/2025 - Version 2.6: </h3> - Mise a jour de securite.</p></br><p><h3>20/03/2025 - Version 2.5: </h3> - Visualisation distincte des couches ne se trouvant pas dans l'antenne.</p></br><p><h3>13/02/2025 - Version 2.4: </h3> - Ajoute redimensionnement et déplacement mollette.</p></br><p><h3>05/02/2025 - Version 2.3: </h3> - Bouton de visualisation des couches se trouvent uniquement dans le canva de la carte.</p></br><p><h3>07/01/2025 - Version 2.2: </h3> - ByPass du certif ssl ci erreur.</p></br><p><h3>22/10/2024 - Version 2.1:</h3> - Correctif de bug.</br> - Evolution de la limit de 3 à 5. </br></p></br><p><h3>22/10/2024 - Version 2.0:</h3> - Reformatage du code.</br></p></br><p><h3>03/10/2024 - Version 1.14:</h3> - Remonte la fênetre dans la pille.</br></p><p><h3>13/09/2024 - Version 1.13:</h3>- MAJ sur le lien du changelog</br>- Bug-fix: Ouvre MultiPolygone et Polygon séparément.</p></br><p><h3>10/09/2024 - Version 1.11:</h3>- Ouverture de table contenant plusieurs géométries.</p></br><p><h3>26/08/2024 - Version 1.10:</h3>- Ajoute d'un changelog et vérification de mise à jour.</p> changelog=<h2>CenRa_FLUX:</h2></br><p><h3>05/03/2026 - Version 3.20: </h3> - Visualisation des metadonnees avec un tooltip au survol de la couche.</p></br><p><h3>26/02/2026 - Version 3.19: </h3> - Visualisation des droits pour les vues materialisees.</p></br><p><h3>25/02/2026 - Version 3.18: </h3> - Filtre par secteur geographique compatible avec les favoris.</p></br><p><h3>12/02/2026 - Version 3.17: </h3> - Favorit dans la BD Ref.</p></br><p><h3>11/02/2026 - Version 3.16: </h3> - Creation de favori et visualisation.</p></br><p><h3>10/02/2026 - Version 3.15: </h3> - Sauvegarde la recherche.</p></br><p><h3>08/12/2025 - Version 3.14: </h3> - message d'erreur pour les drois de couche sur la DB.</p></br><p><h3>08/12/2025 - Version 3.13: </h3> - Detection des droit utilisateur.</p></br><p><h3>25/09/2025 - Version 3.12: </h3> - version +1.</p></br><p><h3>25/09/2025 - Version 3.11: </h3> - Correctife sur les code 00.</p></br><p><h3>24/09/2025 - Version 3.10: </h3> - Erreur sur l ouverture des couche raster. </p></br><p><h3>24/09/2025 - Version 3.9: </h3> - bugfix lier aux extention pgsql.</p></br><p><h3>09/09/2025 - Version 3.8: </h3> - Bug REF fix.</p></br><p><h3>05/09/2025 - Version 3.7: </h3> - Ouverture de projet QGIS contenue dans la base de donnees.</p></br><p><h3>30/07/2025 - Version 3.6: </h3> - Correctife de bug.</p></br><p><h3>29/07/2025 - Version 3.5: </h3> - Bug fix sur les donnee raster.</p></br><p><h3>23/07/2025 - Version 3.4: </h3> - Ouverture raster dans la base SIG.</p></br><p><h3>23/07/2025 - Version 3.3: </h3> - Optimisation des chargement.</p></br><p><h3>22/07/2025 - Version 3.2: </h3> - Visualisation des format raster et vecteur dans REF.</p></br><p><h3>21/07/2025 - Version 3.1: </h3> - Bug fix pour l'ouverture de plus de 5 couches.</p></br><p><h3>19/05/2025 - Version 3.0: </h3> - Compatible PyQt5 et PyQt6.</p></br><p><h3>09/04/2025 - Version 2.9: </h3> - Correctif bug en TT.</p></br><p><h3>09/04/2025 - Version 2.8: </h3> - Optimisation pour le TT.</p></br><p><h3>07/04/2025 - Version 2.7: </h3> - mode debug.</p></br><p><h3>03/04/2025 - Version 2.6: </h3> - Mise a jour de securite.</p></br><p><h3>20/03/2025 - Version 2.5: </h3> - Visualisation distincte des couches ne se trouvant pas dans l'antenne.</p></br><p><h3>13/02/2025 - Version 2.4: </h3> - Ajoute redimensionnement et déplacement mollette.</p></br><p><h3>05/02/2025 - Version 2.3: </h3> - Bouton de visualisation des couches se trouvent uniquement dans le canva de la carte.</p></br><p><h3>07/01/2025 - Version 2.2: </h3> - ByPass du certif ssl ci erreur.</p></br><p><h3>22/10/2024 - Version 2.1:</h3> - Correctif de bug.</br> - Evolution de la limit de 3 à 5. </br></p></br><p><h3>22/10/2024 - Version 2.0:</h3> - Reformatage du code.</br></p></br><p><h3>03/10/2024 - Version 1.14:</h3> - Remonte la fênetre dans la pille.</br></p><p><h3>13/09/2024 - Version 1.13:</h3>- MAJ sur le lien du changelog</br>- Bug-fix: Ouvre MultiPolygone et Polygon séparément.</p></br><p><h3>10/09/2024 - Version 1.11:</h3>- Ouverture de table contenant plusieurs géométries.</p></br><p><h3>26/08/2024 - Version 1.10:</h3>- Ajoute d'un changelog et vérification de mise à jour.</p>
# deprecated flag (applies to the whole plugin, not just a single version) # deprecated flag (applies to the whole plugin, not just a single version)
deprecated=False deprecated=False

View File

@ -2,13 +2,57 @@
schemaname_distinct = """SELECT DISTINCT schemaname from pg_catalog.pg_tables schemaname_distinct = """SELECT DISTINCT schemaname from pg_catalog.pg_tables
WHERE schemaname NOT LIKE '_archives' AND schemaname NOT LIKE 'topology' AND schemaname NOT LIKE 'information_schema' AND schemaname NOT LIKE 'pg_catalog' and schemaname NOT LIKE 'public' AND schemaname NOT LIKE '_trier' WHERE schemaname NOT LIKE '_archives' AND schemaname NOT LIKE 'topology' AND schemaname NOT LIKE 'information_schema' AND schemaname NOT LIKE 'pg_catalog' and schemaname NOT LIKE 'public' AND schemaname NOT LIKE '_trier'
order by schemaname;""" order by schemaname;"""
schemaname_list_ref = """SELECT schemaname,tablename from pg_catalog.pg_tables
WHERE schemaname NOT LIKE '_archives' AND schemaname NOT LIKE 'topology' AND schemaname NOT LIKE 'information_schema' AND schemaname NOT LIKE 'pg_catalog' and schemaname NOT LIKE 'public' AND schemaname NOT LIKE '_trier' schemaname_list_ref = """
order by schemaname,tablename;""" WITH TableList AS (SELECT
schemaname_list = """(SELECT schemaname,tablename from pg_catalog.pg_tables schemaname,
where schemaname like 'trav%' or schemaname like '\\_ag%' or schemaname like '\\_00%' or schemaname like '\\_01%' or schemaname like '\\_07%' or schemaname like '\\_26%' or schemaname like '\\_form%' or schemaname like '\\_42%' or schemaname like '\\_69%' order by schemaname,tablename) tablename
UNION FROM pg_catalog.pg_tables
(SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews order by schemaname,tablename) order by schemaname,tablename;""" WHERE
schemaname NOT LIKE '_archives' AND schemaname NOT LIKE 'topology' AND schemaname NOT LIKE 'information_schema' AND schemaname NOT LIKE 'pg_catalog' and schemaname NOT LIKE 'public' AND schemaname NOT LIKE '_trier'
ORDER BY schemaname,tablename),
TableDescription AS (SELECT
schemaname,
tablename,
description
FROM TableList
LEFT JOIN pg_description ON objoid = (quote_ident(schemaname)||'.'||quote_ident(tablename))::regclass
ORDER BY schemaname, tablename)
SELECT * FROM TableDescription;
"""
schemaname_list = """
WITH
TableList as (SELECT
schemaname,
tablename
FROM pg_catalog.pg_tables
WHERE schemaname LIKE 'trav%' OR schemaname LIKE '_ag%' OR schemaname LIKE '_00%' OR schemaname LIKE '_01%' OR schemaname LIKE '_07%' OR schemaname LIKE '_26%' OR schemaname LIKE '_form%' OR schemaname LIKE '_42%' OR schemaname LIKE '_69%'
ORDER BY schemaname,tablename),
ViewList as (SELECT
schemaname,
matviewname AS tablename
FROM pg_catalog.pg_matviews
ORDER BY schemaname,tablename),
TableAndView as (SELECT
schemaname,
tablename
FROM TableList
UNION SELECT schemaname,tablename FROM ViewList),
TableViewDescription as (SELECT
schemaname,
tablename,
description
FROM TableAndView
LEFT JOIN pg_description ON objoid = (quote_ident(schemaname)||'.'||quote_ident(tablename))::regclass
ORDER BY schemaname,tablename)
SELECT * FROM TableViewDescription;
"""
geom = "geom" geom = "geom"
champ_travaux_prevus_multipolygon = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))""" champ_travaux_prevus_multipolygon = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
champ_travaux_prevus_multilinestring = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, longueur_m double precision, longueur_km double precision, date_creation date, date_maj date, geom geometry(MultiLineString,2154))""" champ_travaux_prevus_multilinestring = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, longueur_m double precision, longueur_km double precision, date_creation date, date_maj date, geom geometry(MultiLineString,2154))"""

View File

@ -50,9 +50,9 @@
<tags>cenra,sicen</tags> <tags>cenra,sicen</tags>
</pyqgis_plugin> </pyqgis_plugin>
<pyqgis_plugin name="CenRa_FLUX" version="3.16"> <pyqgis_plugin name="CenRa_FLUX" version="3.20">
<description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description> <description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description>
<version>3.16</version> <version>3.20</version>
<qgis_minimum_version>3.16</qgis_minimum_version> <qgis_minimum_version>3.16</qgis_minimum_version>
<homepage>https://plateformesig.cenra-outils.org/</homepage> <homepage>https://plateformesig.cenra-outils.org/</homepage>
<file_name>CenRa_FLUX.zip</file_name> <file_name>CenRa_FLUX.zip</file_name>
@ -61,7 +61,7 @@
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_FLUX.zip</download_url> <download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_FLUX.zip</download_url>
<uploaded_by>CEN-Rhone-Alpes</uploaded_by> <uploaded_by>CEN-Rhone-Alpes</uploaded_by>
<create_date>2024-02-06</create_date> <create_date>2024-02-06</create_date>
<update_date>2026-02-11</update_date> <update_date>2026-03-05</update_date>
<experimental>False</experimental> <experimental>False</experimental>
<deprecated>False</deprecated> <deprecated>False</deprecated>
<tags>cenra,flux</tags> <tags>cenra,flux</tags>