Last active
January 18, 2018 12:30
-
-
Save huylenq/62d3a710de2e40df80fb397d0d36a2a9 to your computer and use it in GitHub Desktop.
A complete Embulk Input Plugin in 2 dozens lines of code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| in: | |
| type: simple | |
| out: | |
| type: file | |
| file_ext: csv | |
| path_prefix: '' | |
| formatter: {type: csv} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;: Run by `embulk -clj simple.clj config.yml` (and with this embulk fork https://github.com/huylenq/embulk) | |
| (ns simple | |
| (:require [embulk.spik.core :refer :all] | |
| [embulk.spik.restful :refer :all] | |
| [clojure.spec.alpha :as s])) | |
| (s/def ::target (partial contains? #{"posts" "comments" "albums"})) | |
| (defconfigs | |
| :target {:type :string | |
| :spec ::target} | |
| {:req [:target]}) | |
| (defgraph | |
| "https://jsonplaceholder.typicode.com/" | |
| (posts [:id :string | |
| :userId :string | |
| :body :string | |
| :title :string] | |
| (:id (comments))) | |
| (comments [:id :string | |
| :email :string | |
| :body :string]) | |
| (albums [])) | |
| (pumper (get graph (:target *task*)) :associations true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment