Data Resource - Csv
About
csv is a supported tabular file data resource.
Attributes
A csv file may get the following data attributes:
| Name | Default Value | Description |
|---|---|---|
| comment-character | # | The character that if found as the first character of a line makes the line a comment |
| delimiter-character | , | The character that delimits every fields (ie columns) |
| escape-character | null | The character that when found before a CSV character, set it as a character and not as a property |
| header-row-id | 1 | The row id where the header is located (0 means no header and 1 the first line) |
| ignore-empty-line | true | Empty line are ignored |
| quote-character | " | The character that enclose a field value. |
Because a csv file is also a text file, you can also set text attributes
Manifest
Example of attributes setting in a kind resource manifest
kind: csv
spec:
data-def:
logical-name: favorite_books
header-row-id: 1
delimiter-character: ','
columns:
- name: asin
type: varchar
precision: 20
- name: description
type: varchar
- name: price
type: double
- name: group
type: varchar
You can then use the manifest for any data operation on the csv file
tabul data print books--csv.yml@howto
books.csv@md
asin description price group
------------- ------------------------------------------- ----- ----------
B007US9NA8 The New Encyclopedia of Modern Bodybuilding 27.18 Sports
1439199191 How To Win Friends And Influence People 27.18 Psychology
9780465050659 The Design of Everyday Things 9.99 Design
9780465050659 The Design of Everyday Things 9.99 Psychology
B00555X8OA Thinking, Fast and Slow 8.85 Decision
B00555X8OA Thinking, Fast and Slow 8.85 Psychology