Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109272
| 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 | 2016-05-31 15:52 +1000 |
| Message-ID | <mailman.45.1464673933.1839.python-list@python.org> (permalink) |
| References | <705c69aa-f82d-4e03-9d83-bb33ed20ad4d@googlegroups.com> <85r3ci7rpx.fsf@benfinney.id.au> <mailman.44.1464670453.1839.python-list@python.org> <e19fa02f-e842-490f-9ad9-307cacd2a829@googlegroups.com> <85mvn67p18.fsf@benfinney.id.au> |
Sayth Renshaw <flebber.crue@gmail.com> writes: > Ah so I should create a function that processes and modifies in the > middle of the process between obtaining and committing. Separating the tasks: * Get the data from the database, into a form useful inside your program. (For a Python program manipulating records from a database, a mapping is best because you'll be referring to fields by name.) * Serialise the altered data back to the database. How you do this depends on what the program expects for a database API; my general recommendation is, don't re-invent the wheel. > Or if I need to do this and more processing should I be using > something like sqlalchemy or peewee > http://docs.peewee-orm.com/en/latest/ ? SQLAlchemy is certainly worth learning, so that you can decide when its power and complexity are needed. I'm not familiar with Peewee. If you find that you are writing a lot of code just to handle the interface between the database and the Python program, definitely use SQLAlchemy or something like it, that's what they are for. -- \ “Value your freedom or you will lose it, teaches history. | `\ “Don't bother us with politics,” respond those who don't want | _o__) to learn.” —Richard M. Stallman, 2002 | 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