In order to import data from NocoDB, you need to set the following environment variables:
FROIDE_EVIDENCECOLLECTION_NOCODB_API_URL: The base URL of the NocoDB instance.FROIDE_EVIDENCECOLLECTION_NOCODB_API_TOKEN: The API token for accessing the NocoDB API.- IDs for the tables in NocoDB that contain the data to be imported. You can get a table's ID by right-clicking on the name in the left-hand menu in NocoDB.
FROIDE_EVIDENCECOLLECTION_NOCODB_TABLE_ACTORFROIDE_EVIDENCECOLLECTION_NOCODB_TABLE_AFFILIATIONFROIDE_EVIDENCECOLLECTION_NOCODB_TABLE_EVIDENCEFROIDE_EVIDENCECOLLECTION_NOCODB_TABLE_ROLE
- IDs for certain views in NocoDB that are used for the import:
FROIDE_EVIDENCECOLLECTION_NOCODB_VIEW_ACTOR_ORGANIZATIONFROIDE_EVIDENCECOLLECTION_NOCODB_VIEW_ACTOR_PERSON
FROIDE_EVIDENCECOLLECTION_NOCODB_IMPORT_CONFIG: a dictionary containing additional configuration options, see thesettings/base.pyfile in thefragdenstaat_deproject.
The import can be run manually using the following command from the Django project in which froide_evidencecollection is installed:
python manage.py import_nocodbThis will by default import data from the configured NocoDB tables except for the Evidence table. For importing the full data run
python manage.py import_nocodb --fullIf DEBUG is set to True, any import errors will be caught and logged. If DEBUG is set to False, the import will fail immediately on any error and any changes will be rolled back.
Similarly to the import, you can export data to NocoDB using the following command:
python manage.py export_nocodbTo rebuild the search index for the froide_evidencecollection app, you can use the following command:
python manage.py search_index --rebuild --models froide_evidencecollectionRun tests with pytest:
docker compose -f compose-dev.yaml up
# --create-db option is only needed the first time.
pytest --create-dbRun tests with coverage:
coverage run -m pytest && coverage reportAlternatively, you can run make test or make testci.