Git Product home page Git Product logo

embulk-filter-eval's Introduction

Eval filter plugin for Embulk

Evaluate the row element by ruby code

Overview

  • Plugin type: filter

Configuration

  • eval_columns: (array)
    • The ruby code to be evaluated for each element
  • out_columns: (array)
    • The column to be output from the input columns

install

$ embulk gem install embulk-filter-eval

Example

$ embulk example
$ embulk guess embulk-example/example.yml -o config.yml
$ embulk preview config.yml

+---------+--------------+-------------------------+-------------------------+----------------------------+
| id:long | account:long |          time:timestamp |      purchase:timestamp |             comment:string |
+---------+--------------+-------------------------+-------------------------+----------------------------+
|       1 |       32,864 | 2015-01-27 19:23:49 UTC | 2015-01-27 00:00:00 UTC |                     embulk |
|       2 |       14,824 | 2015-01-27 19:01:23 UTC | 2015-01-27 00:00:00 UTC |               embulk jruby |
|       3 |       27,559 | 2015-01-28 02:20:02 UTC | 2015-01-28 00:00:00 UTC | Embulk "csv" parser plugin |
|       4 |       11,270 | 2015-01-29 11:54:36 UTC | 2015-01-29 00:00:00 UTC |                       NULL |
+---------+--------------+-------------------------+-------------------------+----------------------------+

config.yml as follows

filters:
  - type: eval
    eval_columns:
      - id: value + 1
      - account:
      - time: Time.now
      - comment: "'Eval is Evil! ' + value"

value is an element of the column.
Such as sample, output will be this.

+---------+--------------+-----------------------------+-------------------------+------------------------------------------+
| id:long | account:long |              time:timestamp |      purchase:timestamp |                           comment:string |
+---------+--------------+-----------------------------+-------------------------+------------------------------------------+
|       2 |       32,864 | 2015-03-13 13:20:18.753 UTC | 2015-01-27 00:00:00 UTC |                     Eval is Evil! embulk |
|       3 |       14,824 | 2015-03-13 13:20:18.754 UTC | 2015-01-27 00:00:00 UTC |               Eval is Evil! embulk jruby |
|       4 |       27,559 | 2015-03-13 13:20:18.755 UTC | 2015-01-28 00:00:00 UTC | Eval is Evil! Embulk "csv" parser plugin |
|       5 |       11,270 | 2015-03-13 13:20:18.756 UTC | 2015-01-29 00:00:00 UTC |                       Eval is Evil! NULL |
+---------+--------------+-----------------------------+-------------------------+------------------------------------------+

Build

$ rake

embulk-filter-eval's People

Contributors

mgi166 avatar

Watchers

Shoma FUKUDA avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.