Skip to content

[feature] allow pretty-printing #1845

Closed
@lovasoa

Description

@lovasoa

In rust, the Display trait allows specifying an "alternate" display style for every type:

https://doc.rust-lang.org/std/fmt/struct.Formatter.html#method.alternate

I suggest using this to allow "pretty-printing" SQL statements, including newlines.

Currently, long queries printed by sqlparser are hardly human-readable, since they are displayed as a single long line of text. We could allow displaying them with newlines between keywords and expressions when they are printed with {:#}

this is also a potential more feasible alternative to #1634

I could implement this myself.

What do you think, @alamb , @iffyio ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions