Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/jonathas/fileloader

A file loader written in Perl that reads a tsv file and loads its content into a MySQL database
https://github.com/jonathas/fileloader

fileloader mysql perl

Last synced: about 1 month ago
JSON representation

A file loader written in Perl that reads a tsv file and loads its content into a MySQL database

Awesome Lists containing this project

README

        

# FileLoader

A "loader" that is executed with parameters: path, file_mask

Then connects to the DB (MySQL), looks to given path, reads a tab separated text file, loads file content to DB and moves file to {path}/executed

Rules:

- If there already exists record in DB with given ID, that record is updated with information from file and update_timestamp is set to system current timestamp.
- If new record is detected in file, new record is created in DB with attributes from file and Update_timestamp is set to system current timestamp.
- If any update is detected, record in DB is updated and Update_timestamp is set to system current timestamp.
- If record does not exist in the file, no action is taken.

Files shall contain 3 columns:

```
ID (varchar 32)
Name (varchar 255)
Date (date)
```

Database stores in one table:

```
ID (varchar 32)
Name (varchar 255)
Date (date)
Update_timestamp (timestamp)
```

Usage:

```
fileloader.pl path file_mask
```

Example:

```
fileloader.pl /var/loader_files headers.tsv
```

----

TODO:

- Improve error handling
- Implement Unit Tests