Re: Query ID Values

2018-05-14 Thread Ian Zimmerman
On 2018-05-14 21:12, Adrian Klaver wrote:

> Because you are doing fetchall(). That is going to fetch a list of row
> tuples.  Either iterate over that list or iterate over the cursor:
> 
> for row in cur_p:
>   print(row)
> 
> For more info see:
> http://initd.org/psycopg/docs/cursor.html

Where does that webpage say that I can use the cursor itself for
iteration?  I can't find it there.  (OTOH it is clearly documented for
the sqlite3 library).

Until now, with psycopg2 I have done it like this:

cur.execute(stmt)
results = iter(cur.fetchone, None)
for r in results:
...

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.



Re: Syndicating PostgreSQL mailing list to Discourse

2018-05-25 Thread Ian Zimmerman
On 2018-05-25 14:03, Adrian Klaver wrote:

> > If our mirror archive gets enough traction we'd like to make it
> > possible to sign up to the forum and seamlessly interact with the
> > mailing list,
> 
> Well 'seamlessly works' would be the important part. In the past when
> this was tried(can't remember the who) the posts lagged noticeably and
> content went missing.

Also (as with any kind of message gateway) please, Please, **PLEASE**
preserve the Message-ID when crossing the boundaries.  Otherwise
threading goes out of the window, despite the best efforts of those
among us who still care about it.

This is the reason why I stopped following gnu.* hierarchy (which is
joined two way with @gnu.org mailing lists by Mailman, and Mailman
violates this rule).  If you do it wrong, I'll stop following this list
too. 

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.



Re: JSONB Array of Strings (with GIN index) versus Split Rows (B-Tree Index)

2019-02-04 Thread Ian Zimmerman
On 2019-02-04 05:34, Syed Jafri wrote:

> |-|--|-|--|
> |  Receiver   |   Event  | Date|  
> Location|
> |-|--|-|--|
> |   Alpha | 3|  12 | USA  
> |
> |-|--|-|--|
> |   Bravo | 3|  12 | USA  
> |
> |-|--|-|--|
> |   Charlie   | 3|  12 | USA  
> |
> |-|--|-|--|

Please forgive a naive question, but doesn't this simply cry out for a
normalization step?

EventID   Date   Location
3 12 USA

Receiver  EventID
Alpha 3
Bravo 3
Charlie   3

If you want to use JSON by any means necessary, perhaps a simpler
key/value store is more appropriate than a relational DB like Postgres?

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.