|
1 | | -# ETL-LOGGING |
2 | 1 |
|
3 | | -[](https://codecov.io/github/xmalet-nrcan/xm-etl-toolbox) |
| 2 | +# NRCAN ETL Toolbox |
| 3 | + |
4 | 4 |
|
| 5 | +[](https://codecov.io/github/xmalet-nrcan/xm-etl-toolbox) |
5 | 6 | [](https://github.com/xmalet-nrcan/xm-etl-toolbox/actions/workflows/ci-release.yml) |
6 | 7 |
|
7 | | -`etl-logging` est un package Python destiné à faciliter la gestion du logging dans des processus ETL. Il offre des fonctionnalités simples et modulables pour configurer, écrire et analyser les logs de vos applications. |
| 8 | +Pour la version française de ce document, consultez [README-fr.md](README-fr.md). |
| 9 | + |
| 10 | + |
| 11 | +`etl-toolbox` is a Python toolkit designed to simplify Extract, Transform, and Load (ETL) data processes. This modular toolkit offers several specialized components for different aspects of ETL workflows. |
| 12 | + |
| 13 | +## Components |
| 14 | + |
| 15 | +### etl_logging |
| 16 | +Specialized logging module for ETL processes, allowing simple configuration and efficient log analysis. |
| 17 | + |
| 18 | +### etl_toolbox |
| 19 | +Collection of tools for reading data from various sources. It includes readers for different file formats and databases, facilitating data integration in ETL processes: |
| 20 | +- **Data Readers**: CSV, Excel, GeoPackage, JSON, PostGIS, Shapefile |
| 21 | + |
| 22 | + |
| 23 | +### database |
| 24 | +Interfaces and ORM for interacting with different database systems: |
| 25 | +- **Database Interfaces**: Abstract object handlers for database interactions |
| 26 | +- **ORM**: Object-relational mappings to simplify data access |
8 | 27 |
|
9 | 28 | ## Installation |
10 | 29 |
|
11 | | -Vous pouvez installer elt-logging via Poetry : |
| 30 | +Install the package via Poetry: |
12 | 31 |
|
13 | 32 | ```bash |
14 | 33 | poetry install |
15 | 34 | ``` |
16 | 35 |
|
17 | | -Ou en créant une distribution avec Poetry : |
| 36 | +Or by creating a distribution: |
18 | 37 |
|
19 | 38 | ```bash |
20 | 39 | poetry build |
21 | | -pip install dist/elt_logging-0.1.0-py3-none-any.whl |
| 40 | +pip install dist/nrcan_etl_toolbox-*.whl |
22 | 41 | ``` |
23 | 42 |
|
24 | | -## Utilisation |
| 43 | +## Usage |
| 44 | + |
| 45 | +### Logging Module (etl_logging) |
25 | 46 |
|
26 | | -Voici un exemple d'utilisation de base : |
| 47 | +```python |
| 48 | +from nrcan_etl_toolbox.etl_logging import CustomLogger |
| 49 | + |
| 50 | +logger = CustomLogger(level='INFO' |
| 51 | + ,logger_type='verbose', |
| 52 | + logger_file_name='test_logger.log') |
| 53 | + |
| 54 | +# Logging messages |
| 55 | +logger.info("Starting ETL process") |
| 56 | +logger.debug("Technical details", extra={"data": {"items": 100}}) |
| 57 | +logger.error("Processing error", exc_info=True) |
| 58 | +``` |
| 59 | + |
| 60 | +### Data Readers (etl_toolbox) |
27 | 61 |
|
28 | 62 | ```python |
29 | | -from elt_logging import logger |
| 63 | +from nrcan_etl_toolbox.etl_toolbox.reader import ReaderFactory |
30 | 64 |
|
31 | | -# Configuration du logger (à adapter selon vos besoins) |
32 | | -logger.configure(level="INFO") |
| 65 | +# Creating a CSV reader |
| 66 | +csv_reader = ReaderFactory(input_source="data.csv") |
| 67 | +data = csv_reader.data |
33 | 68 |
|
34 | | -# Enregistrement d'un message |
35 | | -logger.info("Lancement du processus ETL") |
| 69 | +# Creating a Shapefile reader |
| 70 | +shp_reader = ReaderFactory(input_source="data.shp") |
| 71 | +geo_data = shp_reader.data |
36 | 72 | ``` |
37 | 73 |
|
38 | | -## Configuration |
| 74 | +### Database Interface |
39 | 75 |
|
40 | | -Vous pouvez adapter la configuration du logger selon les spécificités de votre projet. Consultez la documentation interne pour en savoir plus sur les options disponibles. |
| 76 | +```python |
| 77 | +# TODO: Complete documentation. |
| 78 | +from nrcan_etl_toolbox.database.interface import AbstractDatabaseHandler |
| 79 | +# Usage example to be documented |
| 80 | +``` |
41 | 81 |
|
42 | | -## Développement |
| 82 | +## Development |
43 | 83 |
|
44 | | -Pour contribuer au projet, installez les dépendances de développement : |
| 84 | +To contribute to the project, install development dependencies: |
45 | 85 |
|
46 | 86 | ```bash |
47 | 87 | poetry install --with dev |
48 | 88 | ``` |
49 | 89 |
|
50 | | -Ensuite, vous pouvez lancer les tests avec : |
| 90 | +Run tests with: |
51 | 91 |
|
52 | 92 | ```bash |
53 | 93 | pytest |
54 | 94 | ``` |
55 | 95 |
|
56 | | -## License |
| 96 | +## Project Structure |
| 97 | + |
| 98 | +``` |
| 99 | +nrcan_etl_toolbox/ |
| 100 | +├── database/ # Database interactions |
| 101 | +│ ├── interface/ # Abstract interfaces for databases |
| 102 | +│ └── orm/ # Object-relational mappings |
| 103 | +├── etl_logging/ # ETL logging module |
| 104 | +└── etl_toolbox/ # Main ETL tools |
| 105 | + └── reader/ # Data source readers |
| 106 | + └── source_readers/ # Specific reader implementations |
| 107 | +``` |
| 108 | + |
| 109 | +[//]: # (## License) |
57 | 110 |
|
58 | | -Ce projet est distribué sous licence MIT. Voir le fichier [LICENSE](LICENSE) pour plus d'informations. |
| 111 | +[//]: # () |
| 112 | +[//]: # (This project is distributed under the MIT license. See the [LICENSE](LICENSE) file for more information.) |
59 | 113 |
|
60 | | -## Auteurs |
| 114 | +## Authors |
61 | 115 |
|
62 | | - |
| 116 | +- NRCAN (Natural Resources Canada) |
| 117 | +- [Xavier Malet ](mailto:[email protected]) |
63 | 118 |
|
64 | | -N'hésitez pas à contribuer et à signaler des bugs ou des améliorations via le dépôt GitLab/GitHub du projet. |
| 119 | +For questions or suggestions, please use the project's GitHub issues. |
0 commit comments