Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document pprinting mysql cmd line output #396

Closed
borkdude opened this issue Apr 29, 2020 · 0 comments · Fixed by #1024
Closed

document pprinting mysql cmd line output #396

borkdude opened this issue Apr 29, 2020 · 0 comments · Fixed by #1024

Comments

@borkdude
Copy link
Collaborator

borkdude commented Apr 29, 2020

(def table-as-str (:out (shell/sh "mysql" "-udba" "-pdba" "corp" "--column-names" "-e" "select * from company_settings_nodes limit 2")))
(def table-as-lines (str/split-lines table-as-str))
(def table-headers (str/split (first table-as-lines) #"\t"))
(def table-as-maps (map #(zipmap table-headers (str/split %1 #"\t")) (rest table-as-lines)))
(clojure.pprint/print-table table-headers table-as-maps)
| id | parent_node_id |     short_name | value_data_type | is_value_optional |            title | description | node_type |
|----+----------------+----------------+-----------------+-------------------+------------------+-------------+-----------|
|  1 |           NULL |         orders |            NULL |                 0 |           Orders |        NULL |  CATEGORY |
|  2 |              1 | orders.packing |            NULL |                 0 | Packing Services |        NULL |  CATEGORY |

cc @bherrmann7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant