Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109270
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ben Finney <ben+python@benfinney.id.au> |
| Newsgroups | comp.lang.python |
| Subject | Re: Best way to inplace alter a list going into postgres |
| Date | Tue, 31 May 2016 14:54:02 +1000 |
| Lines | 22 |
| Message-ID | <mailman.44.1464670453.1839.python-list@python.org> (permalink) |
| References | <705c69aa-f82d-4e03-9d83-bb33ed20ad4d@googlegroups.com> <85r3ci7rpx.fsf@benfinney.id.au> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.uni-berlin.de ZM6w3ARq1byf7f9e5BkVhQm8cc8bPBAp3qCaHDaOoNMQ== |
| Cancel-Lock | sha1:PyM2jIl20Oh4SFP+GnwCbmFZEbk= |
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'modify': 0.04; 'correct.': 0.07; 'type,': 0.07; 'alter': 0.09; 'indicates': 0.09; 'postgres': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:into': 0.09; 'question.': 0.13; 'example).': 0.16; 'inability': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; "python's": 0.23; 'split': 0.23; 'header:User-Agent:1': 0.26; 'subject:list': 0.26; 'header:X-Complaints-To:1': 0.26; '(such': 0.27; 'sequence': 0.27; 'record': 0.29; 'convert': 0.29; 'instead,': 0.33; 'list': 0.34; 'mapping': 0.35; 'but': 0.36; 'list,': 0.36; 'should': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'received:org': 0.37; 'list.': 0.37; 'names': 0.38; 'data': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.40; 'field': 0.60; 'your': 0.60; 'decision': 0.61; '_o__)': 0.84; 'mencken': 0.84; 'received:125': 0.84; '\xe2\x80\x94henry': 0.84; 'subject:Best': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | jigong.madmonks.org |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <85r3ci7rpx.fsf@benfinney.id.au> |
| X-Mailman-Original-References | <705c69aa-f82d-4e03-9d83-bb33ed20ad4d@googlegroups.com> |
| Xref | csiph.com comp.lang.python:109270 |
Show key headers only | View raw
Sayth Renshaw <flebber.crue@gmail.com> writes: > What is the best way to inplace alter a list going into a postgres > database using split but being sure that the order of items remains > correct. That's a trick question. The best way to modify fields of a record is not with a list. Instead, you should get the record in the form of a mapping (such as Python's built-in mapping type, ‘dict’) and alter the fields *by name*. Ony when it's time to serialise the data should you then convert it to a list, extracting by the sequence of field names (‘horseattrs’ in your example). -- \ “Firmness in decision is often merely a form of stupidity. It | `\ indicates an inability to think the same thing out twice.” | _o__) —Henry L. Mencken | Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Best way to inplace alter a list going into postgres Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-30 21:27 -0700
Re: Best way to inplace alter a list going into postgres Ben Finney <ben+python@benfinney.id.au> - 2016-05-31 14:54 +1000
Re: Best way to inplace alter a list going into postgres Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-30 22:42 -0700
Re: Best way to inplace alter a list going into postgres Ben Finney <ben+python@benfinney.id.au> - 2016-05-31 15:52 +1000
Re: Best way to inplace alter a list going into postgres Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-05-31 15:58 +1000
Re: Best way to inplace alter a list going into postgres Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-30 23:19 -0700
Re: Best way to inplace alter a list going into postgres Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-31 01:46 -0700
Re: Best way to inplace alter a list going into postgres Ben Finney <ben+python@benfinney.id.au> - 2016-06-01 06:10 +1000
csiph-web