Re: Query Advice - Mailing list pgsql-sql

From Gary Chambers
Subject Re: Query Advice
Date
Msg-id alpine.DEB.2.20.1703301505350.17355@websrv.gogca.com
Whole thread Raw
In response to Re: Query Advice  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-sql
Gentlemen,

Thank you for your replies.

I'm working on a Python Flask web application.

> To comment as to "better" without any knowledge of the "application layer"
> doesn't make sense.  I suggest you provide an example of what you'd like
> the output to look like independent of any query concerns.

"Better" is to have the results returned without having the address columns
delimited by some character.  The simple join that Jason suggested is
definitely sufficient, but it seems like returning the repeating name column
is unnecessary.

My question is really more theoretical than anything else.  Vincent's
suggestion to return JSON is probably the closest to what I am trying to
accomplish.  My ultimate goal is to have the equivalent of a Python list of
dictionaries as addresses, though the keys aren't a requirement as long as I
can define the order of the columns and avoid using the delimiter.

That being said, how would I accomplish this and return the data in the
usual SQL results format without using concat_ws()?

Thank you, again, for your advice.

--
G.



pgsql-sql by date:

Previous
From: Jason Aleski
Date:
Subject: Re: Query Advice
Next
From: Gary Chambers
Date:
Subject: Re: Query Advice