-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render SQL statements in a single line. #103
base: master
Are you sure you want to change the base?
Conversation
This change makes it easier to grep for queries in PostgreSQL's log, as well as copy-pasting said queries.
@@ -200,7 +200,7 @@ table4columndata :: [(Column O.PGInt4, Column O.PGInt4)] | |||
table4columndata = table4dataG | |||
|
|||
table6data :: [(String, String)] | |||
table6data = [("xy", "a"), ("z", "a"), ("more text", "a")] | |||
table6data = [("xy", "a"), ("z", "a"), ("more \n text", "a")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor test to check whether newlines are preserved in strings. They are.
I'm not opposed to this but I'd prefer to hear from others what they think first. On the other hand I would happily merge a flag to choose SQL formatting style. |
Sure, let's discuss it. A couple of more comments/opinion about this:
|
It would be great if there were a flag of some sort, like Tom mentioned. Exposing a higher-order function might be a good way to implement this. I like the one-line format should be the default for postgresql consumption, like @k0001 said. I definitely use the pretty printing functions for debugging, and I really like having the indentation for those purposes. |
I could see the ability to choose being useful for us. We'd just stick this in our Config so our library's interface wouldn't change regardless of opaleye's implementation. |
I've been super busy, so got behind with PRs. Renzo, ultimately I like your idea that what is sent over the wire should be on a single line. We should have two separate functions |
Sorry this has been languishing. I've remained super busy. I'm happy for the SQL that goes over the wire to be on a single line. I think we should preseve the existing behaviour of functions in Could you make those changes and rebase to HEAD? Then I'll be happy to merge. |
This change makes it easier to grep for queries in PostgreSQL's log, as well as copy-pasting said queries.