Pyrseas icon indicating copy to clipboard operation
Pyrseas copied to clipboard

Multiline Strings (source: |2) Output Unstable

Open salamsp opened this issue 2 years ago • 5 comments

I have Python 3.9 installed on my PC, but command

dbtoyaml --multiple-files db_development

produced output source: |2 and usual source: "\n<>... in the same call. Is it possible to setup this explicitly?

salamsp avatar Feb 08 '22 19:02 salamsp

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 ...

jmafc avatar Feb 08 '22 20:02 jmafc

@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.

jmafc avatar Aug 30 '22 13:08 jmafc

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: @.***>

salamsp avatar Aug 30 '22 15:08 salamsp

Sorry to hear that. Stay well.

jmafc avatar Aug 30 '22 15:08 jmafc

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: @.***>

salamsp avatar Oct 11 '22 06:10 salamsp