From: Rob Sargent <robjsargent@gmail.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Rich Shepard <rshepard@appl-ecosys.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Formating psql query output
Date: Mon, 19 Jul 2021 12:01:22 -0600
Message-ID: <8DC70752-D1F1-4841-8E68-C7103764B144@gmail.com> (raw)
In-Reply-To: <4f001abb-7f6d-d098-ed10-1c5445c0ba1c@aklaver.com>
References: <alpine.LNX.2.20.2107191021180.13362@salmo.appl-ecosys.com>
<4f001abb-7f6d-d098-ed10-1c5445c0ba1c@aklaver.com>
> On Jul 19, 2021, at 11:49 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>
> On 7/19/21 10:33 AM, Rich Shepard wrote:
>> Until I finish building the python/tkinter/psycopg2 front end to my business
>> tracking tool I continue to work using the psql shell.'
>> I have a working .sql script that reports my contacts between two dates; the
>> script returns more columns than I want included in the report. I want to
>> pipe the output through an awk script to extract, in order, the columns I
>> need. I'm stuck at the point of defining options to psql.
>
> Is there a reason you can't just restrict the query to the columns you want?
>
Also had that thought but OP is wise to head the other switches for cleaner output. But also should probably get familiar with to-json options as well for easy pickup on the eventual client.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: robjsargent@gmail.com, adrian.klaver@aklaver.com, rshepard@appl-ecosys.com
Subject: Re: Formating psql query output
In-Reply-To: <8DC70752-D1F1-4841-8E68-C7103764B144@gmail.com>
References: <alpine.LNX.2.20.2107191021180.13362@salmo.appl-ecosys.com> <4f001abb-7f6d-d098-ed10-1c5445c0ba1c@aklaver.com> <8DC70752-D1F1-4841-8E68-C7103764B144@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox