git clone git@github.com:cbn-alpin/sinp-paca-data.git
rsync -av --copy-unsafe-links --exclude var --exclude .git --exclude .editorconfig --exclude .vscode --exclude .gitignore --exclude settings.ini --exclude "data/raw/*" --exclude venv ./ geonat@db-paca-sinp:~/data/ --dry-run
--dry-run
si tout semble ok pour effectuer le transfert réelsudo chmod o+x /usr/bin/gcc
. Une fois l'installation terminée, retirer les à nouveau avec chmod o-x /usr/bin/gcc
.ssh geonat@db-paca-sinp
mkdir -p backups/data
mv data backups/data/$(date +%F)
mkdir data
ssh geonat@db-paca-sinp
cd ~/data/cbna
cp config/settings.sample.ini config/settings.ini
vi config/settings.ini
cd ~/data/cbna/data/raw/ ; rm -f *.{csv,ini}
screen -S import-cbna
cd bin/ ; ./import_initial.sh -v
ssh admin@<sinp-db>
screen -S import-cbna
psql
\c gnatlas
SELECT atlas.refresh_materialized_view_data() ;
SELECT atlas.refresh_materialized_view_ref_geo()
ssh geonat@sinp-<region>-web
cd ~/www/taxhub/data/scripts/import_inpn_media
python3 -m venv venv
source venv/bin/activate
sudo chmod o+x /usr/bin/gcc
pip install psycopg2 requests
sudo chmod o-x /usr/bin/gcc
. cp config.py.sample config.py
SQLALCHEMY_DATABASE_URI = "postgresql://geonatadmin:<mot-de-passe>@10.0.1.10:5432/geonature2db"
QUERY_SELECT_CDREF = """SELECT DISTINCT cd_ref FROM taxonomie.bib_noms ORDER BY cd_ref LIMIT 100"""
: supprimer le LIMIT 100
une fois un premier test effectué python import_inpn_media.py
deactivate
WITH first_media AS ( SELECT MIN(id_media) AS first_id_media_founded, cd_ref FROM taxonomie.t_medias GROUP BY cd_ref ) UPDATE taxonomie.t_medias AS tm SET id_type = 1 FROM first_media AS fm WHERE tm.id_media = fm.first_id_media_founded AND tm.cd_ref = fm.cd_ref ;
REFRESH MATERIALIZED VIEW atlas.vm_medias WITH DATA ; REFRESH MATERIALIZED VIEW atlas.vm_taxons_plus_observes WITH DATA ;