Opening a SQLite session on my Rasp Pi 4 to look around in the WeeWx database

57 views
Skip to first unread message

DR

unread,
Apr 4, 2022, 1:04:11 PM4/4/22
to weewx...@googlegroups.com
I have been looking for some way to open a command line or browser
driven version of SQLite to snoop around inside the WeeWx database just
to become more familiar with the layout.  I'm not trying to correct any
errors (I am not that worried about the way I use WeeWx mainly to
capture the day and generate graphs which get posted to my web server),
but just want to look around.  Using the latest WeeWx install on a Rasp
400 to play and start to try to customize a bit.


I have, obviously SQLite3 on the system, running or I don't think that
WeeWx would function.  I have found the directory where the database
exists based on the documentation in the User Guide.  I can't find any
documentation as to how to trigger SQLite so I can uses command lines,
and while there  are a few things for Linux that say they allow you to
open a browser like window to look at the database, once I download
them, I don't find where they are installed or how to trigger them to
open up.  I assume from the screen shots of them that there is a way to
change directories until I get to the WeeWx database, but  can't even
try doing that.


Oh, once I get to be able to do this, do I have to shut down WeeWx while
I look around, or can WeeWx continue to access the SQLite database at
the same time to keep updating it when it needs to?  Or is there a
collision and it will require a restart of WeeWx to pickup again once
I'm done peeking inside?

Dale


John Kline

unread,
Apr 4, 2022, 1:20:25 PM4/4/22
to weewx...@googlegroups.com
You can browse without shutting down weewx. Just pass sqlite3 the location of your weewx database (for me, that’s in /home/weewx/archive).

$ sqlite3 /home/weewx/archive/weewx.sdb
SQLite version 3.34.1 2021-01-20 14:10:07
Enter ".help" for usage hints.
sqlite> select dateTime, outTemp from archive order by dateTime desc limit 1;
1649078100|48.6

> On Apr 4, 2022, at 6:04 AM, DR <daleea...@gmail.com> wrote:
>
> I have been looking for some way to open a command line or browser driven version of SQLite to snoop around inside the WeeWx database just to become more familiar with the layout. I'm not trying to correct any errors (I am not that worried about the way I use WeeWx mainly to capture the day and generate graphs which get posted to my web server), but just want to look around. Using the latest WeeWx install on a Rasp 400 to play and start to try to customize a bit.
>
>
> I have, obviously SQLite3 on the system, running or I don't think that WeeWx would function. I have found the directory where the database exists based on the documentation in the User Guide. I can't find any documentation as to how to trigger SQLite so I can uses command lines, and while there are a few things for Linux that say they allow you to open a browser like window to look at the database, once I download them, I don't find where they are installed or how to trigger them to open up. I assume from the screen shots of them that there is a way to change directories until I get to the WeeWx database, but can't even try doing that.
>
>
> Oh, once I get to be able to do this, do I have to shut down WeeWx while I look around, or can WeeWx continue to access the SQLite database at the same time to keep updating it when it needs to? Or is there a collision and it will require a restart of WeeWx to pickup again once I'm done peeking inside?
>
> Dale
>
>
> --
> You received this message because you are subscribed to the Google Groups "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/6791f34e-ce65-d411-a7f0-511f58e02c26%40gmail.com.

Greg Troxel

unread,
Apr 4, 2022, 1:49:54 PM4/4/22
to DR, weewx...@googlegroups.com

And, in addition to the advice you just got:

Make a backup of the database before you start.

If you just want to look, instead of running sqlite3 on the database,
copy the file to a different place and look at the copy. If you
aren't skilled in SQL, you might damage the database by typing some
command that modifies it. It is normal in places with real data to
have a prohibition on direct SQL database access except by the
database admin, more or less. Getting SQL commands right is 100x
harder than starting sqlite3 on a file....


signature.asc

Chuck Rhode

unread,
Apr 4, 2022, 2:09:18 PM4/4/22
to weewx...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 4 Apr 2022 08:04:06 -0500
DR <daleea...@gmail.com> wrote:

> I have been looking for some way to open a command line or browser
> driven version of SQLite to snoop around inside the WeeWx database
> just to become more familiar with the layout.

The thing you want is *sqlitebrowser*. Install it. Then, just type
that at the command prompt. Alternatively, you can start it as a
Gnome application by searching for "DB Browser." Try F)ile O)open
Database Read Only. You're shooting for the WeeWX "Archive" folder.
To see the *.sdb file, you'll need to toggle to the "All Files" filter
on the "Choose Database File" dialog.


- --
.. Be Seeing You,
.. Chuck Rhode, Sheboygan, WI, USA
.. Weather: http://LacusVeris.com/WX
.. 38° — Wind SSE 12 mph — Sky overcast. Mist.

-----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQT+MY/5I/LMPSswTbVg2/xipKOWUgUCYkr8AAAKCRBg2/xipKOW
UqW/AJ4lcQFlVz7Nho+pc+MOFvUct4Sf2wCcD/bljSptW50d66AfmUsx3cj491w=
=F4PK
-----END PGP SIGNATURE-----

DR

unread,
Apr 4, 2022, 5:07:14 PM4/4/22
to weewx...@googlegroups.com
Thank you for the replies.  I will try the various alternatives to see
which works best for me right now.

Learning is sometimes difficult when your brain is stuck in windows
land!  When things are put in paths when loaded, and where things are 
stored in Debian is still a learning curve for me.  I have a notebook by
my keyboard.  Again thanks for this group's patience and help.   Dale

Chuck Rhode

unread,
Apr 4, 2022, 9:08:38 PM4/4/22
to weewx...@googlegroups.com
On Mon, 4 Apr 2022 08:04:06 -0500
DR <daleea...@gmail.com> wrote:

> I have been looking for some way to open a command line or browser
> driven version of SQLite to snoop around inside the WeeWx database
> just to become more familiar with the layout.

The thing you want is *sqlitebrowser*. Install it. Then, just type
that at the command prompt. Alternatively, you can start it as a
Gnome application by searching for "DB Browser." Try F)ile O)open
Database Read Only. You're shooting for the WeeWX "Archive" folder.
To see the *.sdb file, you'll need to toggle to the "All Files" filter
on the "Choose Database File" dialog.

--
.. Be Seeing You,
.. Chuck Rhode, Sheboygan, WI, USA
.. Weather: http://LacusVeris.com/WX
.. 43° — Wind WNW 16 mph — Sky overcast.

Reply all
Reply to author
Forward
0 new messages