Re: reduce number of multiple values to be inserted

2018-06-01 Thread Steven Lembark
On Wed, 30 May 2018 08:10:05 +0800 tango ward wrote: > curr_pgsql.execute(''' >INSERT INTO student (created, modified, name, > address, age, > level ) >VALUES (current_timezone, current_timezone, >

Re: reduce number of multiple values to be inserted

2018-05-29 Thread tango ward
On Wed, May 30, 2018 at 8:40 AM, Rob Sargent wrote: > > > > On 05/29/2018 06:36 PM, Adrian Klaver wrote: > >> On 05/29/2018 05:10 PM, tango ward wrote: >> >>> >>> Hi, >>> >> Not sure where you are pulling the data from and how it is ordered, but >> an outline: >> >> data_input (Assuming sorted

Re: reduce number of multiple values to be inserted

2018-05-29 Thread Rob Sargent
On 05/29/2018 06:36 PM, Adrian Klaver wrote: On 05/29/2018 05:10 PM, tango ward wrote: Hi, Not sure where you are pulling the data from and how it is ordered, but an outline: data_input (Assuming sorted by village and then age) for village in data_input: for age in village:

Re: reduce number of multiple values to be inserted

2018-05-29 Thread Adrian Klaver
On 05/29/2018 05:10 PM, tango ward wrote: Hi, I am working on inserting multiple values for a table. I need to insert 3 values of data for each age of the students from the same village. It will be 3 different ages of student per village. My sample code: curr_pgsql.execute('''   

Re: reduce number of multiple values to be inserted

2018-05-29 Thread Rob Sargent
> On May 29, 2018, at 6:32 PM, tango ward wrote: > > On Wed, May 30, 2018 at 8:29 AM, Rob Sargent > wrote: > > Is “current_timezone, current_timezone” just a typo? I think you need to > make the 117 data lines and load using \copy > > > > Sorry, yeah, it's

Re: reduce number of multiple values to be inserted

2018-05-29 Thread tango ward
On Wed, May 30, 2018 at 8:29 AM, Rob Sargent wrote: > > Is “current_timezone, current_timezone” just a typo? I think you need to > make the 117 data lines and load using \copy > > Sorry, yeah, it's current_timestamp.

Re: reduce number of multiple values to be inserted

2018-05-29 Thread Rob Sargent
> On May 29, 2018, at 6:10 PM, tango ward wrote: > > > Hi, > > I am working on inserting multiple values for a table. I need to insert 3 > values of data for each age of the students from the same village. It will be > 3 different ages of student per village. > > My sample code: > > >

Re: reduce number of multiple values to be inserted

2018-05-29 Thread tango ward
On Wed, May 30, 2018 at 8:21 AM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Tuesday, May 29, 2018, tango ward wrote: >> >> I will repeat the same process for 13 villages so that will be 117 of >> values. I would like to know if there's a way to reduce the script? This >> has to

Re: reduce number of multiple values to be inserted

2018-05-29 Thread David G. Johnston
On Tuesday, May 29, 2018, tango ward wrote: > > I will repeat the same process for 13 villages so that will be 117 of > values. I would like to know if there's a way to reduce the script? This > has to be done strictly via script. > > VALUES and CROSS JOIN might help but you haven't explained the

reduce number of multiple values to be inserted

2018-05-29 Thread tango ward
Hi, I am working on inserting multiple values for a table. I need to insert 3 values of data for each age of the students from the same village. It will be 3 different ages of student per village. My sample code: curr_pgsql.execute(''' INSERT INTO student (created, modified,