Re: Best way to inplace alter a list going into postgres

2016-05-31 Thread Ben Finney
Sayth Renshaw writes: > Probably easier to handle in postgres > http://stackoverflow.com/a/37538641/461887 Yes, a proper RDBMS is expressly optimised for manipulating the data. Especially when the problem at hand is expressible as a set operation, the RDBMS is almost always the better place to

Re: Best way to inplace alter a list going into postgres

2016-05-31 Thread Sayth Renshaw
Probably easier to handle in postgres http://stackoverflow.com/a/37538641/461887 select c1[1] as col1, c1[2] as col2, c1[3] as col3, c1[4] as col4, substr(col5, 2) as col5 from ( select string_to_array((string_to_array(the_column, ' '))[1], '-') as c1, (s

Re: Best way to inplace alter a list going into postgres

2016-05-30 Thread Sayth Renshaw
On Tuesday, 31 May 2016 15:58:40 UTC+10, Steven D'Aprano wrote: > On Tuesday 31 May 2016 14:27, Sayth Renshaw wrote: > > > > > Hi > > > > What is the best way to inplace alter a list going into a postgres database > > Is it relevant where it is going? > > What you do with the list after you a

Re: Best way to inplace alter a list going into postgres

2016-05-30 Thread Steven D'Aprano
On Tuesday 31 May 2016 14:27, Sayth Renshaw wrote: > > Hi > > What is the best way to inplace alter a list going into a postgres database Is it relevant where it is going? What you do with the list after you alter it is irrelevant -- perhaps you will insert it into an Oracle database, or a pl

Re: Best way to inplace alter a list going into postgres

2016-05-30 Thread Ben Finney
Sayth Renshaw 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

Re: Best way to inplace alter a list going into postgres

2016-05-30 Thread Sayth Renshaw
Ah so I should create a function that processes and modifies in the middle of the process between obtaining and committing. 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/ ? Sayth -- https://mail.python.org

Re: Best way to inplace alter a list going into postgres

2016-05-30 Thread Ben Finney
Sayth Renshaw 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 i

Best way to inplace alter a list going into postgres

2016-05-30 Thread Sayth Renshaw
Hi 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. I am using this list of ids to retrieve data from XML horseattrs = ('id', 'race_id', 'horse', 'number', 'finished', 'age', 'sex', 'bl