Re: [sqlite] Fwd: inserting new data only

2020-02-26 Thread Jose Isaias Cabrera
James K. Lowden, on Wednesday, February 26, 2020 11:55 AM, wrote... > > On Tue, 25 Feb 2020 12:02:24 -0500 > Przemek Klosowski wrote: > > > and I want to avoid storing repetitive data, so that the database > > should contain > > 10:32 12 > > 10:35 15 > > 10:39 13 > > 10:46 18 > > where only

Re: [sqlite] Fwd: inserting new data only

2020-02-26 Thread Przemek Klosowski
On Wed, Feb 26, 2020 at 11:56 AM James K. Lowden wrote: > > and I want to avoid storing repetitive data, so that the database > > should contain > > [...] > > only the earliest time with the unchanging value is stored. > > Be careful what you wish for. Usually "avoid storing" is a proxy for >

Re: [sqlite] Fwd: inserting new data only

2020-02-26 Thread James K. Lowden
On Tue, 25 Feb 2020 12:02:24 -0500 Przemek Klosowski wrote: > and I want to avoid storing repetitive data, so that the database > should contain > 10:32 12 > 10:35 15 > 10:39 13 > 10:46 18 > where only the earliest time with the unchanging value is stored. Be careful what you wish for.

Re: [sqlite] Fwd: inserting new data only

2020-02-25 Thread Keith Medcalf
>From: sqlite-users On >Behalf Of Keith Medcalf >Sent: Tuesday, 25 February, 2020 14:44 >To: SQLite mailing list >Subject: Re: [sqlite] Fwd: inserting new data only > > >If you are going to do it in all in one insert statement rather than >using a before trigge

Re: [sqlite] Fwd: inserting new data only

2020-02-25 Thread Keith Medcalf
t;Subject: Re: [sqlite] Fwd: inserting new data only > > >On Tuesday, 25 February, 2020 12:23, Przemek Klosowski > wrote: > >>On Tue, Feb 25, 2020 at 1:18 PM Keith Medcalf >wrote: > >>> create table data >>> ( >>> keytext primary key, >

Re: [sqlite] Fwd: inserting new data only

2020-02-25 Thread Keith Medcalf
On Tuesday, 25 February, 2020 12:23, Przemek Klosowski wrote: >On Tue, Feb 25, 2020 at 1:18 PM Keith Medcalf wrote: >> create table data >> ( >> keytext primary key, >> data integer not null >> ) >> without rowid; >> >> -- insert into data select ?, ? as value where value IS

Re: [sqlite] Fwd: inserting new data only

2020-02-25 Thread David Raymond
Awesome---exactly what's needed. The monotonicity of the time key variable is assured by how the data is collected---but is there a way to express that in sqlite? create table data ( key text primary key check (julianday(key) > julianday(select max(key) from data), data integer not null);

Re: [sqlite] Fwd: inserting new data only

2020-02-25 Thread Przemek Klosowski
On Tue, Feb 25, 2020 at 1:18 PM Keith Medcalf wrote: > create table data > ( > keytext primary key, > data integer not null > ) > without rowid; > > -- insert into data select (?, ? as value where value IS NOT (select data > from (select max(key), data from data)); >.. >

Re: [sqlite] Fwd: inserting new data only

2020-02-25 Thread Keith Medcalf
Keith Medcalf >Sent: Tuesday, 25 February, 2020 11:18 >To: 'SQLite mailing list' >Subject: RE: [sqlite] Fwd: inserting new data only > > >create table data >( >keytext primary key, >data integer not null >) >without rowid; > >-- inser

Re: [sqlite] Fwd: inserting new data only

2020-02-25 Thread Keith Medcalf
e's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users On >Behalf Of Przemek Klosowski >Sent: Tuesday, 25 February, 2020 10:02 >To: SQLite mailing list >Subject: [sqlite] Fwd: inserting new data

Re: [sqlite] Fwd: inserting new data only

2020-02-25 Thread Przemek Klosowski
On Tue, Feb 25, 2020 at 1:03 PM John McKown wrote: > > I am storing time series data arriving from a sensor into (time,value) > > records, like so: > > 10:32 12 > > 10:35 15 > > 10:37 15 > > 10:39 13 > > 10:43 13 > > 10:46 18 > > > > and I want to avoid storing repetitive data, so that the

Re: [sqlite] Fwd: inserting new data only

2020-02-25 Thread Przemek Klosowski
rigger can't prevent the subsequent insert. > > > -Original Message- > From: sqlite-users On Behalf > Of Przemek Klosowski > Sent: Tuesday, February 25, 2020 12:02 PM > To: SQLite mailing list > Subject: [sqlite] Fwd: inserting new data only > > I am storing time serie

Re: [sqlite] Fwd: inserting new data only

2020-02-25 Thread John McKown
On Tue, Feb 25, 2020 at 11:03 AM Przemek Klosowski < przemek.klosowski+sql...@gmail.com> wrote: > I am storing time series data arriving from a sensor into (time,value) > records, like so: > 10:32 12 > 10:35 15 > 10:37 15 > 10:39 13 > 10:43 13 > 10:46 18 > > and I want to avoid storing

Re: [sqlite] Fwd: inserting new data only

2020-02-25 Thread David Raymond
to let you know what happened you could make it select raise(abort, 'Repeated entry'); -Original Message- From: sqlite-users On Behalf Of Przemek Klosowski Sent: Tuesday, February 25, 2020 12:02 PM To: SQLite mailing list Subject: [sqlite] Fwd: inserting new data only I am storing time

[sqlite] Fwd: inserting new data only

2020-02-25 Thread Przemek Klosowski
I am storing time series data arriving from a sensor into (time,value) records, like so: 10:32 12 10:35 15 10:37 15 10:39 13 10:43 13 10:46 18 and I want to avoid storing repetitive data, so that the database should contain 10:32 12 10:35 15 10:39 13 10:46 18 where only the earliest