An open API service indexing awesome lists of open source software.

https://github.com/irfnrdh/csv-import-db

Just another import db by directory wathing from ftp to database using rust
https://github.com/irfnrdh/csv-import-db

import-csv rust

Last synced: 3 months ago
JSON representation

Just another import db by directory wathing from ftp to database using rust

Awesome Lists containing this project

README

        

# Multi-Database CSV Importer

## ๐Ÿš€ Overview

A robust, flexible Rust-based CSV importer that supports multiple databases, real-time file watching, data validation, and notification systems.

## โœจ Features

- **Multi-Database Support**
- PostgreSQL
- MySQL
- MariaDB
- SQLite (Planned)

- **Advanced CSV Processing**
- Real-time directory watching
- Automatic CSV file detection
- Data validation
- Duplicate detection
- Batch insertions

- **Flexible Notifications**
- Telegram
- Email (Planned)
- Slack (Planned)
- Custom notification channels (Planned)

## ๐Ÿ›  Installation

### Prerequisites

- Rust (latest stable version)
- Cargo
- Database servers (PostgreSQL, MySQL)

### Setup

1. Clone the repository
```bash
git clone https://github.com/irfnrdh/csv-import-db.git
cd csv-import-db
```

2. Install dependencies
```bash
cargo build
```

## ๐Ÿ“ Configuration

Create a `config.toml` file with your database and notification settings:

```toml
[database]
types = ["postgresql", "mysql"]
host = "localhost"
port = 5432
username = "your_username"
password = "your_password"

[notification]
telegram_token = "your_telegram_bot_token"
telegram_chat_id = "your_chat_id"
```

## ๐Ÿš€ Usage

```bash
cargo run --release
```

Generate Dataset Samples
```bash
cargo run --bin generate_csv
```
## ๐Ÿ“‚ Project Structure

```
multi-db-csv-importer/
โ”‚
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ main.rs # Main application entry point
โ”‚ โ”œโ”€โ”€ config/ # Configuration handling
โ”‚ โ”‚ โ”œโ”€โ”€ mod.rs
โ”‚ โ”‚ โ”œโ”€โ”€ database.rs
โ”‚ โ”‚ โ””โ”€โ”€ notification.rs
โ”‚ โ”‚
โ”‚ โ”œโ”€โ”€ importers/ # CSV import logic
โ”‚ โ”‚ โ”œโ”€โ”€ mod.rs
โ”‚ โ”‚ โ”œโ”€โ”€ csv_processor.rs
โ”‚ โ”‚ โ””โ”€โ”€ validator.rs
โ”‚ โ”‚
โ”‚ โ”œโ”€โ”€ database/ # Database connectors
โ”‚ โ”‚ โ”œโ”€โ”€ mod.rs
โ”‚ โ”‚ โ”œโ”€โ”€ mysql.rs
โ”‚ โ”‚ โ”œโ”€โ”€ postgres.rs
โ”‚ โ”‚ โ””โ”€โ”€ sqlite.rs
โ”‚ โ”‚
โ”‚ โ””โ”€โ”€ notifications/ # Notification systems
โ”‚ โ”œโ”€โ”€ mod.rs
โ”‚ โ”œโ”€โ”€ telegram.rs
โ”‚ โ””โ”€โ”€ email.rs
โ”‚
โ”œโ”€โ”€ tests/ # Unit and integration tests
โ”‚ โ”œโ”€โ”€ database_tests.rs
โ”‚ โ””โ”€โ”€ importer_tests.rs
โ”‚
โ”œโ”€โ”€ Cargo.toml # Project dependencies
โ”œโ”€โ”€ Config.toml # Project env
โ”œโ”€โ”€ README.md # Project documentation
โ”œโ”€โ”€ LICENSE # Project license
โ””โ”€โ”€ .gitignore # Git ignore file
```

## ๐Ÿงช Testing

Run tests with:
```bash
cargo test
```

## ๐Ÿค Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## ๐Ÿ“„ License

Distributed under the MIT License. See `LICENSE` for more information.

## ๐Ÿ“ง Contact

Irfannur Diah - [email protected]

Project Link: [https://github.com/irfnrdh/csv-import-db](https://github.com/irfnrdh/csv-import-db)