Symfony Bundle - Use file watchers with MariaDb Columnstore CpImport utility

dev-master / 1.0.x-dev 2018-04-12 11:49 UTC

This package is auto-updated.

Last update: 2020-06-14 15:05:27 UTC


MariaDb ColumnStore is a very powerful, column-oriented MySQL storage, powerful for analytics and Big Data.

It has the drawback of extremely slow write operations, but comes with cpimport, a binary that can load CSV files with millions of rows into the table of your choice, in a few seconds.

This Symfony bundle enables a file watcher that will look into a directory, pick up new CSV files when they come, run cpimport and delete them.


composer require bentools/cpimport-bundle:1.0.x-dev


Add the bundle to your kernel. Then, map your directories to database/tables like this:

# config/packages/cpimport.yaml (or app/config.yml in Symfony 3)

    cpimport_bin: /usr/local/mariadb/columnstore/bin/cpimport
            database: my_shop
            table: sales_day
                delimiter: ','
                enclosure: '"'
                timeout: 60


To automatically process new files in configured directories:

php bin/console cpimport:watch

To manually process a CSV file through cpimport:

php bin/console cpimport:run my_shop sales_day path/to/file.csv --delimiter=','