Reputation: 31
I have several YAML files that store SQL scripts in them (as multiline strings). I have a Python script that takes all of these scripts and aggregates them into a single table.
Whenever I make an update to a YAML file, it converts the SQL text to a regular string (with \n
's to indicate line breaks). Is there a way to preserve the multiline formatting when I make updates to the YAML file?
Upvotes: 3
Views: 5768
Reputation: 131
For multi-line scalars, you can use blocks. The pipe symbol character |
to denote the start of a block.
For example:
Data: |
Some data, here and a special character like ':'
Another line of data on a separate line
Also you can check the YAML Multiline
Upvotes: 5