django-insee-sirene
Allow to download and import the INSEE Sirène csv files in django models.
Requirements
- Python 3.12+
- Django 4.2+
Installation
- your
DB_ENGINEsetting must be"django.contrib.gis.db.backends.postgis" - run
pip install django-insee-sirene - add
insee_sireneto yourINSTALLED_APPS - run
python manage.py migrate insee_sirene
Download source files
You can use the download management command to download the csv source files :
python manage.py download_insee_sirene_csv_files
The files are downloaded and extracted in a insee_sirene/management/commands/data folder.
They can then be used by the import_insee_sirene and generate_insee_sirene_models commands.
Caution: Keep in mind that files are not removed after calling this command.
By default, the command doesn't re-download the files if they are already in the folder.
Command options:
- Force :
-for--force-download: Force the download of the files - Only :
-oor--only: Download only the given file (ex: -o StockEtablissement_utf8.zip) - Keep archives :
-kor--keep-archives: Keep the .zip archives after extraction
Import
Launch the import management command to download the source import files and download the data in the database :
python manage.py import_insee_sirene
Command options:
- Force :
-for--force-download: Force the download of the files - Keep sources folder :
-kor--keep-sources-folder: Keep downloaded sources folder after import - Chunk size :
--chunk: Amount of lines to read at once and objects bulk created (1000 by default)
Update models
The models are generated by the generate_insee_sirene_models management command.
This command is used to easily generate the models from the csv import files and must be used only by the repository maintainer or if you wish to submit a merge request, following the CONTRIBUTING.md guide.
Metadata
Release files for django-insee-sirene 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_insee_sirene-0.0.5.tar.gz | 29.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_insee_sirene-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 64.9 kB
Release files / django_insee_sirene-0.0.5.tar.gz
| Download URL | django_insee_sirene-0.0.5.tar.gz |
|---|---|
| Size | 29.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e762c97ac1c63564743a29ceb847766e454a47a0635314b3f743ba80c66e203
|
|
BLAKE2b-256 checksum How to use checksums |
c63f7876bc878b857090e7d68b5d6df3178ed1048eefd23cda6ddfcf1295fe2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / django_insee_sirene-0.0.5-py3-none-any.whl
| Download URL | django_insee_sirene-0.0.5-py3-none-any.whl |
|---|---|
| Size | 35.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0225b17dee75060ad37b6e30173d7c2a4f964b2c57599eeb437c46b3d6f97c4
|
|
BLAKE2b-256 checksum How to use checksums |
51ff7872412adea0b2ee479f9d49a8e15f28e4e929f1123f21b5d877de1381a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|