Skip to content

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

License

Notifications You must be signed in to change notification settings

jonathas/fileloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages