Modify the sqlite database with DB Browser to update a new field

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Modify the sqlite database with DB Browser to update a new field

Miel Loinaz
Hello,
I want to modify a sqlite database of a weather station software
(wewx.sdb). Date
and time are in the form of echo or linux time (field date1). I have added
a new field (date2) where I want to display human readable date and time.

In Linux console I get it running:

UPDATE table1 SET date2 = datetime (date1, 'unixepoch', 'localtime');

But I do not know how to modify the sqlite database with DB Browser, I'm a
newbie. Where should I enter this code?

Thanks and Merry Christmas!
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Modify the sqlite database with DB Browser to update a new field

Stephen Chrzanowski
First, be careful with modifying a database you don't control.  This can
result in unexpected results, even if you're tailing onto the end of the
table.  Some calls are like [select * from ThisTable] and the code itself
is expecting exactly the number of fields to be returned.  You may also be
creating a field that might be used somewhere else in the code as an alias,
to which could cause ambiguous errors (Meaning, the code doesn't know which
date2 you're referencing).

Second, it'll depend on what the date1 field contains.  When you say "linux
time", as that phrase sits, I can think of two or three different methods
'Nix flavors display date and time values.

Date/Time functions can be found here:
https://sqlite.org/lang_datefunc.html

If you can show us a subset of records, and what the fields contain, we can
probably come up with a decent query to do a one-time update command (Or
periodic since the code doesn't know how to deal with your new field,
although, you could put in a trigger to automatically update after the
record was inserted)


On Sat, Dec 23, 2017 at 11:34 PM, Miel Loinaz <[hidden email]> wrote:

> Hello,
> I want to modify a sqlite database of a weather station software
> (wewx.sdb). Date
> and time are in the form of echo or linux time (field date1). I have added
> a new field (date2) where I want to display human readable date and time.
>
> In Linux console I get it running:
>
> UPDATE table1 SET date2 = datetime (date1, 'unixepoch', 'localtime');
>
> But I do not know how to modify the sqlite database with DB Browser, I'm a
> newbie. Where should I enter this code?
>
> Thanks and Merry Christmas!
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Modify the sqlite database with DB Browser to update a new field

Keith Medcalf
In reply to this post by Miel Loinaz

This sounds like a "DB Browser" issue, whatever a "DB Browser" is.  You should direct questions about how to enter SQL commands into "DB Browser" to the "DB Browser" support channel.  

This is especially true since it appears that you have solved the problem satisfactorily when using the SQLite3 command line shell.

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>[hidden email]] On Behalf Of Miel Loinaz
>Sent: Saturday, 23 December, 2017 21:34
>To: [hidden email]
>Subject: [sqlite] Modify the sqlite database with DB Browser to
>update a new field
>
>Hello,
>I want to modify a sqlite database of a weather station software
>(wewx.sdb). Date
>and time are in the form of echo or linux time (field date1). I have
>added
>a new field (date2) where I want to display human readable date and
>time.
>
>In Linux console I get it running:
>
>UPDATE table1 SET date2 = datetime (date1, 'unixepoch', 'localtime');
>
>But I do not know how to modify the sqlite database with DB Browser,
>I'm a
>newbie. Where should I enter this code?
>
>Thanks and Merry Christmas!
>_______________________________________________
>sqlite-users mailing list
>[hidden email]
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Modify the sqlite database with DB Browser to update a new field

Chris Locke-3
I would suspect this is "DB Browser for SQLite" application. It has an
'execute SQL' tab, so the raw code can be directly entered, or the table
modified through a gui. It's pretty straightforward to use, and had a wiki
on its support pages.
This isn't the place to guide you though, but it has a very active support
group.



Thanks,
Chris

On 24 Dec 2017 7:17 am, "Keith Medcalf" <[hidden email]> wrote:

>
> This sounds like a "DB Browser" issue, whatever a "DB Browser" is.  You
> should direct questions about how to enter SQL commands into "DB Browser"
> to the "DB Browser" support channel.
>
> This is especially true since it appears that you have solved the problem
> satisfactorily when using the SQLite3 command line shell.
>
> ---
> The fact that there's a Highway to Hell but only a Stairway to Heaven says
> a lot about anticipated traffic volume.
>
>
> >-----Original Message-----
> >From: sqlite-users [mailto:sqlite-users-
> >[hidden email]] On Behalf Of Miel Loinaz
> >Sent: Saturday, 23 December, 2017 21:34
> >To: [hidden email]
> >Subject: [sqlite] Modify the sqlite database with DB Browser to
> >update a new field
> >
> >Hello,
> >I want to modify a sqlite database of a weather station software
> >(wewx.sdb). Date
> >and time are in the form of echo or linux time (field date1). I have
> >added
> >a new field (date2) where I want to display human readable date and
> >time.
> >
> >In Linux console I get it running:
> >
> >UPDATE table1 SET date2 = datetime (date1, 'unixepoch', 'localtime');
> >
> >But I do not know how to modify the sqlite database with DB Browser,
> >I'm a
> >newbie. Where should I enter this code?
> >
> >Thanks and Merry Christmas!
> >_______________________________________________
> >sqlite-users mailing list
> >[hidden email]
> >http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users