Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triggers to Delete/Upsert from json to Metadata/Synthese #2

Closed
lpofredc opened this issue Dec 29, 2020 · 3 comments
Closed

Triggers to Delete/Upsert from json to Metadata/Synthese #2

lpofredc opened this issue Dec 29, 2020 · 3 comments

Comments

@lpofredc
Copy link
Member

Créer les fonctions et triggers pour mettre à jour la synthèse depuis les données téléchargées

@lpofredc
Copy link
Member Author

Partially done (UPSERT, not DELETE) in v0.0.4-dev.
custom scripts to auto populate GeoNature db or anything else.

gn2gn_cli --custom-script synthese <myconfigfile>
gn2gn_cli --custom-script <mycustomscriptfullpath> <myconfigfile>

https://github.com/lpoaura/gn2gn_client/blob/dev/gn2gn/data/to_geonature.sql

@Adrien-Pajot
Copy link
Contributor

Hi !

I just tested gn2pg and I want to thank you for this great API, it works perfectly ! I can import JSON data from a GeoNature export in my local base. I now want to go further and insert these new data in my gn_sythese.synthese.

In the docs you suggest to run : gn2pg_cli --custom-script to_gnsynthese
It returns :

2021-03-02 10:53:04,892 - CRITICAL - store_postgresql:custom_script - file to_gnsynthese DO NOT EXISTS, exit
Traceback (most recent call last):
File "/home/geonatureadmin/.local/bin/gn2pg_cli", line 8, in
sys.exit(run())
File "/home/geonatureadmin/.local/lib/python3.8/site-packages/gn2pg/main.py", line 268, in run
return main(sys.argv[1:])
File "/home/geonatureadmin/.local/lib/python3.8/site-packages/gn2pg/main.py", line 186, in main
manage_pg.custom_script(args.custom_script)
File "/home/geonatureadmin/.local/lib/python3.8/site-packages/gn2pg/store_postgresql.py", line 363, in custom_script
with open(file) as filecontent:
UnboundLocalError: local variable 'file' referenced before assignment

I checked your repo and here I see the v0.0.4-dev of gn2gn_cli which I suppose is the application of gn2pg between to GeoNature ? But are all the script of gn2gn implemented into gn2pg ?

Please @lpofredc, could you add documentation or explain me how to insert my json data into my gn_synthese.synthese ?

All the very best.

@lpofredc
Copy link
Member Author

Fixed. Default command is:

gn2pg_cli --custom-script to_gnsynthese <myconfig>.toml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants