Open c33s opened 7 months ago
Is there a preferred YAML style for doing this? Would that look something like the below in flow-style?
- {index: 0, Data: apple, Bata: natural}
- {index: 1, Data: car, Bata: artificail}
- {index: 2, Data: smash, Bata: intelligence}
- {index: 3, Data: market, Bata: outstanding}
- {index: 4, Data: washing, Bata: brain}
(example from here)
The best feature of YAML in my opinion is its support for multi-line strings - fantastic for if you are working with SQLite tables with large amounts of text data in them.
Those can look like this:
- id: 4
title: The title is here
body: |
This is a multi-line string.
It can be as long as you like.
This does however mean that serializing as YAML is tricky, as you need to be smart about when you use multi-line strings as opposed to the other YAML string formats.
I've not figured out how to do this well myself before. https://yaml.readthedocs.io/ might be a better option that PyYAML if you want more control over how long strings are presented.
if it is possible it would be awesome if this could be configured. in the symfony yaml component there is a level
option.
The second argument of the dump() method customizes the level at which the output switches from the expanded representation to the inline one
https://symfony.com/doc/current/components/yaml.html#expanded-and-inlined-arrays
i love this feature but i havn't found another lib which is able to do that (golang, c, rust, ...). i tried to find a simple json/toml to yaml converter perferrable multiplatform and a single binary. i ended up to stick with php as all converters i found where not able to specify this and even worse, started to sort keys in some way.
so if you find a solution for adding a level config this would be awesome. normally a user would want to have the expanded view to get an overview and then collapse data which is nested (for example json columns).
also it makes sense to have the data structured in the flat way of your example (@adamobeng) sometimes. so i would vote for a config option (optionally config per table)
side idea: a full.ext
file which also contains the tables.
table1:
- {index: 0, Data: apple, Bata: natural}
- {index: 1, Data: car, Bata: artificail}
- {index: 2, Data: smash, Bata: intelligence}
table2:
- {index: 0, Data: apple, Bata: natural}
- {index: 1, Data: car, Bata: artificail}
i know thats all a lot of work, i am just sharing thoughts
it would be nice to also have yaml as supported output format.