PnX-SI / gn_module_monitoring

Module GeoNature de suivi générique pour protocoles de suivi simples
GNU Affero General Public License v3.0
5 stars 23 forks source link

Messages d'avertissement en utilisant la commande geonature #343

Open vprunet opened 5 months ago

vprunet commented 5 months ago

Bonjour les amis, Après avoir installé le module monitoring, la commande geonature affiche des messages d'avertissements à chaque utilisation.

Comment supprimer ces warning? Merci d'avance

(venv) geonatureadmin@geonature-srv:~$ geonature --help
/home/geonatureadmin/gn_module_monitoring/backend/gn_module_monitoring/monitoring/models.py:86: SAWarning: Property TBaseVisits.dataset on mapped class TBaseVisits->t_base_visits being replaced with new property TBaseVisits.dataset; the old property will be discarded
  TBaseVisits.dataset = DB.relationship(TDatasets)
/home/geonatureadmin/gn_module_monitoring/backend/gn_module_monitoring/monitoring/models.py:86: SAWarning: relationship 'TMonitoringObservationDetails.medias' will copy column t_observation_details.uuid_observation_detail to column t_medias.uuid_attached_row, which conflicts with relationship(s): 'CorCountingOccurrence.medias' (copies cor_counting_occtax.unique_id_sinp_occtax to t_medias.uuid_attached_row). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="medias"' to the 'TMonitoringObservationDetails.medias' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  TBaseVisits.dataset = DB.relationship(TDatasets)
/home/geonatureadmin/gn_module_monitoring/backend/gn_module_monitoring/monitoring/models.py:86: SAWarning: relationship 'TObservations.medias' will copy column t_observations.uuid_observation to column t_medias.uuid_attached_row, which conflicts with relationship(s): 'CorCountingOccurrence.medias' (copies cor_counting_occtax.unique_id_sinp_occtax to t_medias.uuid_attached_row), 'TMonitoringObservationDetails.medias' (copies t_observation_details.uuid_observation_detail to t_medias.uuid_attached_row). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="medias,medias"' to the 'TObservations.medias' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  TBaseVisits.dataset = DB.relationship(TDatasets)
/home/geonatureadmin/gn_module_monitoring/backend/gn_module_monitoring/monitoring/models.py:122: SAWarning: implicitly coercing SELECT object to scalar subquery; please use the .scalar_subquery() method to produce a scalar subquery.
  nb_observations = column_property(
/home/geonatureadmin/gn_module_monitoring/backend/gn_module_monitoring/monitoring/models.py:171: SAWarning: implicitly coercing SELECT object to scalar subquery; please use the .scalar_subquery() method to produce a scalar subquery.
  last_visit = column_property(
/home/geonatureadmin/gn_module_monitoring/backend/gn_module_monitoring/monitoring/models.py:177: SAWarning: implicitly coercing SELECT object to scalar subquery; please use the .scalar_subquery() method to produce a scalar subquery.
  nb_visits = column_property(
/home/geonatureadmin/gn_module_monitoring/backend/gn_module_monitoring/monitoring/models.py:222: SAWarning: implicitly coercing SELECT object to scalar subquery; please use the .scalar_subquery() method to produce a scalar subquery.
  nb_sites = column_property(
/home/geonatureadmin/gn_module_monitoring/backend/gn_module_monitoring/monitoring/models.py:228: SAWarning: implicitly coercing SELECT object to scalar subquery; please use the .scalar_subquery() method to produce a scalar subquery.
  nb_visits = column_property(
/home/geonatureadmin/gn_module_monitoring/backend/gn_module_monitoring/monitoring/models.py:329: SAWarning: implicitly coercing SELECT object to scalar subquery; please use the .scalar_subquery() method to produce a scalar subquery.
  TMonitoringSitesGroups.nb_visits = column_property(
/home/geonatureadmin/gn_module_monitoring/backend/gn_module_monitoring/monitoring/models.py:340: SAWarning: implicitly coercing SELECT object to scalar subquery; please use the .scalar_subquery() method to produce a scalar subquery.
  TMonitoringSitesGroups.geom_geojson = column_property(
/home/geonatureadmin/geonature/backend/venv/lib/python3.11/site-packages/marshmallow_sqlalchemy/convert.py:124: SAWarning: relationship 'TMonitoringVisits.medias' will copy column t_base_visits.uuid_base_visit to column t_medias.uuid_attached_row, which conflicts with relationship(s): 'CorCountingOccurrence.medias' (copies cor_counting_occtax.unique_id_sinp_occtax to t_medias.uuid_attached_row), 'TMonitoringObservationDetails.medias' (copies t_observation_details.uuid_observation_detail to t_medias.uuid_attached_row), 'TObservations.medias' (copies t_observations.uuid_observation to t_medias.uuid_attached_row). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="medias,medias,medias"' to the 'TMonitoringVisits.medias' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in model.__mapper__.attrs:
/home/geonatureadmin/geonature/backend/venv/lib/python3.11/site-packages/marshmallow_sqlalchemy/convert.py:124: SAWarning: relationship 'TMonitoringSites.visits' will copy column t_base_sites.id_base_site to column t_base_visits.id_base_site, which conflicts with relationship(s): 'TBaseSites.t_base_visits' (copies t_base_sites.id_base_site to t_base_visits.id_base_site). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="t_base_visits"' to the 'TMonitoringSites.visits' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in model.__mapper__.attrs:
/home/geonatureadmin/geonature/backend/venv/lib/python3.11/site-packages/marshmallow_sqlalchemy/convert.py:124: SAWarning: relationship 'TMonitoringSites.medias' will copy column t_base_sites.uuid_base_site to column t_medias.uuid_attached_row, which conflicts with relationship(s): 'CorCountingOccurrence.medias' (copies cor_counting_occtax.unique_id_sinp_occtax to t_medias.uuid_attached_row), 'TMonitoringObservationDetails.medias' (copies t_observation_details.uuid_observation_detail to t_medias.uuid_attached_row), 'TMonitoringVisits.medias' (copies t_base_visits.uuid_base_visit to t_medias.uuid_attached_row), 'TObservations.medias' (copies t_observations.uuid_observation to t_medias.uuid_attached_row). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="medias,medias,medias,medias"' to the 'TMonitoringSites.medias' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in model.__mapper__.attrs:
/home/geonatureadmin/geonature/backend/venv/lib/python3.11/site-packages/marshmallow_sqlalchemy/convert.py:124: SAWarning: relationship 'TMonitoringSitesGroups.medias' will copy column t_sites_groups.uuid_sites_group to column t_medias.uuid_attached_row, which conflicts with relationship(s): 'CorCountingOccurrence.medias' (copies cor_counting_occtax.unique_id_sinp_occtax to t_medias.uuid_attached_row), 'TMonitoringObservationDetails.medias' (copies t_observation_details.uuid_observation_detail to t_medias.uuid_attached_row), 'TMonitoringSites.medias' (copies t_base_sites.uuid_base_site to t_medias.uuid_attached_row), 'TMonitoringVisits.medias' (copies t_base_visits.uuid_base_visit to t_medias.uuid_attached_row), 'TObservations.medias' (copies t_observations.uuid_observation to t_medias.uuid_attached_row). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="medias,medias,medias,medias,medias"' to the 'TMonitoringSitesGroups.medias' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in model.__mapper__.attrs:
/home/geonatureadmin/geonature/backend/venv/lib/python3.11/site-packages/marshmallow_sqlalchemy/convert.py:124: SAWarning: relationship 'TMonitoringSitesGroups.sites' will copy column t_sites_groups.id_sites_group to column t_site_complements.id_sites_group, which conflicts with relationship(s): 'TMonitoringSites.sites_group' (copies t_sites_groups.id_sites_group to t_site_complements.id_sites_group). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="sites_group"' to the 'TMonitoringSitesGroups.sites' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in model.__mapper__.attrs:
/home/geonatureadmin/geonature/backend/venv/lib/python3.11/site-packages/marshmallow_sqlalchemy/convert.py:124: SAWarning: relationship 'TMonitoringSitesGroups.visits' will copy column t_sites_groups.id_sites_group to column t_site_complements.id_sites_group, which conflicts with relationship(s): 'TMonitoringSites.sites_group' (copies t_sites_groups.id_sites_group to t_site_complements.id_sites_group), 'TMonitoringSitesGroups.sites' (copies t_sites_groups.id_sites_group to t_site_complements.id_sites_group). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="sites,sites_group"' to the 'TMonitoringSitesGroups.visits' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in model.__mapper__.attrs:
/home/geonatureadmin/geonature/backend/venv/lib/python3.11/site-packages/marshmallow_sqlalchemy/convert.py:124: SAWarning: relationship 'TMonitoringModules.medias' will copy column t_module_complements.uuid_module_complement to column t_medias.uuid_attached_row, which conflicts with relationship(s): 'CorCountingOccurrence.medias' (copies cor_counting_occtax.unique_id_sinp_occtax to t_medias.uuid_attached_row), 'TMonitoringObservationDetails.medias' (copies t_observation_details.uuid_observation_detail to t_medias.uuid_attached_row), 'TMonitoringSites.medias' (copies t_base_sites.uuid_base_site to t_medias.uuid_attached_row), 'TMonitoringSitesGroups.medias' (copies t_sites_groups.uuid_sites_group to t_medias.uuid_attached_row), 'TMonitoringVisits.medias' (copies t_base_visits.uuid_base_visit to t_medias.uuid_attached_row), 'TObservations.medias' (copies t_observations.uuid_observation to t_medias.uuid_attached_row). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="medias,medias,medias,medias,medias,medias"' to the 'TMonitoringModules.medias' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in model.__mapper__.attrs:
/home/geonatureadmin/geonature/backend/venv/lib/python3.11/site-packages/marshmallow_sqlalchemy/convert.py:124: SAWarning: relationship 'TMonitoringModules.sites_groups' will copy column t_sites_groups.id_module to column t_module_complements.id_module, which conflicts with relationship(s): 'TMonitoringModules.sites' (copies t_site_complements.id_module to t_module_complements.id_module). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="sites"' to the 'TMonitoringModules.sites_groups' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in model.__mapper__.attrs:
/home/geonatureadmin/geonature/backend/venv/lib/python3.11/site-packages/marshmallow_sqlalchemy/convert.py:124: SAWarning: relationship 'TMonitoringModules.datasets' will copy column t_modules.id_module to column cor_module_dataset.id_module, which conflicts with relationship(s): 'TDatasets.modules' (copies t_modules.id_module to cor_module_dataset.id_module). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="modules"' to the 'TMonitoringModules.datasets' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in model.__mapper__.attrs:
/home/geonatureadmin/geonature/backend/venv/lib/python3.11/site-packages/marshmallow_sqlalchemy/convert.py:124: SAWarning: relationship 'TMonitoringModules.datasets' will copy column t_datasets.id_dataset to column cor_module_dataset.id_dataset, which conflicts with relationship(s): 'TDatasets.modules' (copies t_datasets.id_dataset to cor_module_dataset.id_dataset). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="modules"' to the 'TMonitoringModules.datasets' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in model.__mapper__.attrs:
Usage: geonature [OPTIONS] COMMAND [ARGS]...

Options:
  --version             Show the version and exit.
  -e, --env-file FILE   Load environment variables from this file. python-
                        dotenv must be installed.
  -A, --app IMPORT      The Flask application or factory function to load, in
                        the form 'module:name'. Module can be a dotted import
                        or file path. Name is not required if it is 'app',
                        'application', 'create_app', or 'make_app', and can be
                        'name(args)' to pass arguments.
  --debug / --no-debug  Set debug mode.
  --version             Show the Flask version.
  --help                Show this message and exit.

Commands:
  db                              Perform database migrations.
  default-config                  Afficher l’ensemble des paramètres et...
  dev-back                        Lance l'api du backend avec flask
  generate-frontend-module-config
                                  Génère la config frontend d'un module
  get-config                      Afficher l’ensemble des paramètres
  import
  install-gn-module               Command definition to install a...
  metadata
  monitorings                     Commandes pour ladministration du module
                                  MONITORINGS
  occtax
  permissions
  profiles
  ref_geo                         Manage geographical referential.
  routes                          Show the routes for the app.
  run                             Run a development server.
  sensitivity
  shell                           Run a shell in the app context.
  taxref                          Manager TaxRef referentials.
  update-configuration            Régénère la configuration du front et...
  upgrade-modules-db
camillemonchicourt commented 5 months ago

Oui c'est "normal". Dans GeoNature 2.14, on est passé à SQLAlchemy 1.4 qui inclut pas mal d'évolutions dans la manière d'écrire les requêtes (https://github.com/PnX-SI/GeoNature/issues/1812). Cependant le code SQLA 1.3 reste compatible avec SQLA 1.4 mais lève des warnings. Les autres modules ont été passés en mode SQLA 1.4 mais pas encore le module Monitoring pour lequel un gros développement est en cours depuis plusieurs mois (https://github.com/PnX-SI/gn_module_monitoring/pull/264). Le passage à SQLA 1.4 a été réalisé dans ce gros développement en cours : https://github.com/PnX-SI/gn_module_monitoring/pull/283 Mais on n'a pas fait le travail en double sur la version actuelle.

Donc en attendant que ce développement soit prochainement terminé et publié, le module Monitoring reste encore écrit en mode SQLA 1.3 et lève des warnings avec GeoNature 2.14 (ou plus) qui est passé en SQLA 1.4. Mais pas problématique en terme de fonctionnement.