Pyrseas
Pyrseas copied to clipboard
Multiline Strings (source: |2) Output Unstable
I have Python 3.9 installed on my PC, but command
dbtoyaml --multiple-files db_development
produced output source: |2 and usual source: "\n<
I'm not sure I follow exactly, but let me try. I assume you have two or more functions in your database and, I'm guessing, one of the function's source was output different than the other (and further, perhaps you prefer one style over the other). If that's the case, and IIRC that's a "feature" of the YAML output processor, i.e., it uses one style based on the length of the text or some other parameter. On one of my test databases, I see three "text styles":
function ...:
language: sql
source: |-
SELECT CASE WHEN ...
ELSE ...
...
function ...:
language: plpgsql
source: "\ndeclare ..."
...
view ...:
definition: |2-
SELECT ( ...
In fact all of the views use the ": |2-" which IIRC means the indentation is two spaces. The SQL functions, which use ":|-" have no indentation (or arbitrary indentation. The PLPGSQL functions use a single string enclosed in double quotes, probably because they start with a newline character and it would be difficult for YAML (which in essence uses newlines to replace the "}," delimiters that you find in JSON) to parse something like the following:
source: |-
declare ...
@salamsp Unless you have some other comments, I believe my discussion above shows that the YAML multiline string output is not unstable, so I'd like to close this issue. Let me know.
At the moment I have no possebility to check situation because of war in Ukraine.
Tanks, S.Salamatin
On Tue, Aug 30, 2022, 15:09 Joe Abbate @.***> wrote:
@salamsp https://github.com/salamsp Unless you have some other comments, I believe my discussion above shows that the YAML multiline string output is not unstable, so I'd like to close this issue. Let me know.
— Reply to this email directly, view it on GitHub https://github.com/perseas/Pyrseas/issues/238#issuecomment-1231645072, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB252MRBOJTBTN3UB5OGEWTV3YBWZANCNFSM5N3ODR6Q . You are receiving this because you were mentioned.Message ID: @.***>
Sorry to hear that. Stay well.
Thank you.
On Tue, Aug 30, 2022, 17:37 Joe Abbate @.***> wrote:
Sorry to hear that. Stay well.
— Reply to this email directly, view it on GitHub https://github.com/perseas/Pyrseas/issues/238#issuecomment-1231836306, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB252MUIIPIOT4PRQ6N4BETV3YTCPANCNFSM5N3ODR6Q . You are receiving this because you were mentioned.Message ID: @.***>