[GRASS5] Re: sqlite browser

Markus Neteler wrote:

Hi Moritz,

I just discovered
http://sqlitebrowser.sourceforge.net/
which looks fairly nice.

You had already discovered it before:

http://grass.itc.it/pipermail/grass5/2005-August/019156.html

:wink:

> Maybe solving a problem for us?

I think it is a good solution for those who need such a feature. I am not sure I would recommend packaging it with GRASS, though, as it depends on Qt, and I don't know if we want to package that as well.

However, it might be a good idea to have a GRASS extension with clear instructions on how to install sqlitebrowser.

Moritz

On Thu, Nov 10, 2005 at 04:05:47PM +0100, Moritz Lennert wrote:

Markus Neteler wrote:
>Hi Moritz,
>
>I just discovered
>http://sqlitebrowser.sourceforge.net/
>which looks fairly nice.

You had already discovered it before:

http://grass.itc.it/pipermail/grass5/2005-August/019156.html

:wink:

Oops :slight_smile: But this time I started using it!

> Maybe solving a problem for us?

I think it is a good solution for those who need such a feature. I am
not sure I would recommend packaging it with GRASS, though, as it
depends on Qt, and I don't know if we want to package that as well.

However, it might be a good idea to have a GRASS extension with clear
instructions on how to install sqlitebrowser.

Right.

Markus

> >I just discovered
> >http://sqlitebrowser.sourceforge.net/
> >which looks fairly nice.

..

> I think it is a good solution for those who need such a feature. I
> am not sure I would recommend packaging it with GRASS, though, as
> it depends on Qt, and I don't know if we want to package that as
> well.
>
> However, it might be a good idea to have a GRASS extension with
> clear instructions on how to install sqlitebrowser.

Perhaps just list it on the sqlite help page. (there's a sqlite[,dbf,
Postgres,mysql,etc] help page somewhere, right? Wiki or .html in the
source? Transfer from wiki to .html in the source upon maturity?)

Hamish

On Fri, Nov 11, 2005 at 12:15:56PM +1300, Hamish wrote:

> > >I just discovered
> > >http://sqlitebrowser.sourceforge.net/
> > >which looks fairly nice.
..
> > I think it is a good solution for those who need such a feature. I
> > am not sure I would recommend packaging it with GRASS, though, as
> > it depends on Qt, and I don't know if we want to package that as
> > well.
> >
> > However, it might be a good idea to have a GRASS extension with
> > clear instructions on how to install sqlitebrowser.

Perhaps just list it on the sqlite help page. (there's a sqlite[,dbf,
Postgres,mysql,etc] help page somewhere, right?

I'm not aware of it (which means nothing).

Wiki or .html in the
source? Transfer from wiki to .html in the source upon maturity?)

Yes.

Markus

I just tried this and it's very nice. If we switch to sqlite for the default
attribute database for GRASS, I'd strongly recommend finding a way to
include this as at least an optional add-on for GRASS. This would solve the
need for an attribute management interface.

For compiling, it requires QT, which I agree we don't want to require right
now (though we might later, of course). But I don't think it needs QT for
the binary versions. If any maintainer wants to, they could include it with
a binary distribution. I'd be happy to add it to the database menu if we
started using it on a regular basis.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Markus Neteler <neteler@itc.it>
Date: Thu, 10 Nov 2005 16:15:07 +0100
To: Moritz Lennert <mlennert@club.worldonline.be>
Cc: Grass Developers List <grass5@grass.itc.it>
Subject: [GRASS5] Re: sqlite browser

On Thu, Nov 10, 2005 at 04:05:47PM +0100, Moritz Lennert wrote:

Markus Neteler wrote:

Hi Moritz,

I just discovered
http://sqlitebrowser.sourceforge.net/
which looks fairly nice.

You had already discovered it before:

http://grass.itc.it/pipermail/grass5/2005-August/019156.html

:wink:

Oops :slight_smile: But this time I started using it!

Maybe solving a problem for us?

I think it is a good solution for those who need such a feature. I am
not sure I would recommend packaging it with GRASS, though, as it
depends on Qt, and I don't know if we want to package that as well.

However, it might be a good idea to have a GRASS extension with clear
instructions on how to install sqlitebrowser.

Right.

Markus

> > > However, it might be a good idea to have a GRASS extension with
> > > clear instructions on how to install sqlitebrowser.
>
> Perhaps just list it on the sqlite help page. (there's a
> sqlite[,dbf, Postgres,mysql,etc] help page somewhere, right?

I'm not aware of it (which means nothing).

> Wiki or .html in the
> source? Transfer from wiki to .html in the source upon maturity?)

Yes.

I have set up a VectorDatabase wiki page linked to from the main GrassDocs
page.

http://grass.gdf-hannover.de/twiki/bin/view/GRASS/VectorDatabase

Everyone can contribute to the Wiki page, just create yourself an
account. Please contribute if you can, it is very easy.

Hamish

I just tried this and it's very nice. If we switch to sqlite for the
default attribute database for GRASS, I'd strongly recommend finding a
way to include this as at least an optional add-on for GRASS. This
would solve the need for an attribute management interface.

Can anyone figure out how to run a test when d.m starts to see if
HAVE_SQLITEBROW="`which sqlitebrowser`" works, and if not grey out the
menu item for it? Then it could go into the menu and give people a hint
about what they need to install to get the functionality.

Hamish

Perhaps an environmental variable like SQL_BROWSER_PATH might be useful,
given that the name (on my Mac at least) is full of spaces and has an
embedded version number which will change with every update. Some kind of
find that could return the name and path the the browser could automate
this.

I have several other randomly related thoughts.

1. If we do use sqlite, we need a translation utility between dbf and
sqlite.
2. We might want to have an "sql" directory in each mapset, like we do for
dbf. This would be the location for a default sqlite database for each
mapset, containing tables for each vector file. The default database could
simple carry the name of the mapset. This does not preclude the creation and
use of other sqlite database in other locations, of course.
3. GRASS would need to be able to create an empty sqlite database
automatically for each mapset, so that tables could be added as needed.

The browser could actually live inside the GRASS directory structure (e.g.,
$GISBASE/bin or somewhere else meaningful) if included, as it's not all that
big. In this case, it could be given a simple name like "sqlite_browser".
This might make the test you propose easier. It could also be a link to the
app in another location, but that might get more difficult.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Hamish <hamish_nospam@yahoo.com>
Date: Sat, 12 Nov 2005 20:46:20 +1300
To: Michael Barton <michael.barton@asu.edu>
Cc: <grass5@grass.itc.it>
Subject: Re: [GRASS5] Re: sqlite browser

I just tried this and it's very nice. If we switch to sqlite for the
default attribute database for GRASS, I'd strongly recommend finding a
way to include this as at least an optional add-on for GRASS. This
would solve the need for an attribute management interface.

Can anyone figure out how to run a test when d.m starts to see if
HAVE_SQLITEBROW="`which sqlitebrowser`" works, and if not grey out the
menu item for it? Then it could go into the menu and give people a hint
about what they need to install to get the functionality.

Hamish

Perhaps an environmental variable like SQL_BROWSER_PATH might be
useful, given that the name (on my Mac at least) is full of spaces and
has an embedded version number which will change with every update.
Some kind of find that could return the name and path the the browser
could automate this.

I don't think anything new or fancy is needed-

SQLITE_BROWSER="`which sqlitebrowser`"

should be enough. If a path with a space in it doesn't work, then it is
a variable quoting bug which should be systematically fixed. The browser
executable needs to be in the $PATH, that isn't a big ask.
Worst case make a symlink to it in /usr/local/bin or $GISBASE/bin/.

I have several other randomly related thoughts.

1. If we do use sqlite, we need a translation utility between dbf and
sqlite.

db.copy?

dbview -bt -d '|' | v.in.ascii
(replace dbview utility with db.select?)

The long wished for db.in.ascii module?

2. We might want to have an "sql" directory in each mapset, like we do
for dbf.

Make that a "sqlite" dir, as "sql" is too generic to be meaningful.

This would be the location for a default sqlite database for
each mapset, containing tables for each vector file. The default
database could simple carry the name of the mapset. This does not
preclude the creation and use of other sqlite database in other
locations, of course. 3. GRASS would need to be able to create an
empty sqlite database automatically for each mapset, so that tables
could be added as needed.

Maybe I don't understand sqlite (never used it); why doesn't each map
have its own DB file in the first place? Why does there have to be a
single all-of-mapset one? I can't imagine the overhead per DB is that
huge.

The browser could actually live inside the GRASS directory structure
(e.g., $GISBASE/bin or somewhere else meaningful) if included, as it's
not all that big. In this case, it could be given a simple name like
"sqlite_browser". This might make the test you propose easier. It
could also be a link to the app in another location, but that might
get more difficult.

I think it is best left as an external (and optional?) dependency. I
sure don't want to maintain the thing or keep it in sync. The more we
can outsource to gdal, proj4, etc., the better I think. We've got enough
to work on as it is. It's the packagers' jobs to take care of making
sure those things get installed too...

Also, I would suggest we not make any decision about changing the
default DB to sqlite until after GRASS 6.2 is released.

Hamish

See also point 22 in SUBMITTING:
http://freegis.org/cgi-bin/viewcvs.cgi/*checkout*/grass6/SUBMITTING

22. If you write a shell script and search for a command in $PATH, do
NOT use the "which" command or the "type -p" command. Both commands
are not supported on all platforms, thus causing problems for some
people.

Out of curiosity, which platforms is this a problem on?
Only really old stuff?

As an alternative, please use code similar to the following
shell script snippet which will perform the same function. In this
case, the path of the grass60 command is saved if grass60 is found in
$PATH. This won't recognize aliased command name.

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is a problem on Debian.

e.g.

$ which wish
/usr/bin/wish

$ ls -l /usr/bin/wish
lrwxrwxrwx 1 root root 22 Feb 18 2005 /usr/bin/wish -> /etc/alternatives/wish*

$ ls -l /etc/alternatives/wish
lrwxrwxrwx 1 root root 16 Feb 18 2005 /etc/alternatives/wish -> /usr/bin/wish8.4*

$ ls -1 /usr/bin/ | grep '@' | wc -l
269

Hamish

Hamish wrote:

2. We might want to have an "sql" directory in each mapset, like we do
for dbf.

Make that a "sqlite" dir, as "sql" is too generic to be meaningful.

Why a directory, why not just call the database file sqlite.db in the location directory. or then give the db the same name as the location, and add the .db extension (; That is the way I have set it up.

This would be the location for a default sqlite database for
each mapset, containing tables for each vector file. The default
database could simple carry the name of the mapset. This does not
preclude the creation and use of other sqlite database in other
locations, of course. 3. GRASS would need to be able to create an
empty sqlite database automatically for each mapset, so that tables
could be added as needed.

Maybe I don't understand sqlite (never used it); why doesn't each map
have its own DB file in the first place? Why does there have to be a
single all-of-mapset one? I can't imagine the overhead per DB is that
huge.

It doesn't work like that. In postgress you also have one DB per location, right? Same in SQLite. One file per database, not per table. Oterwise I don't think that you can do any meaningfull selects etc involving many tables.

--Wolf

--

<:3 )---- Wolf Bergenheim ----( 8:>

On Mon, 14 Nov 2005, Hamish wrote:

See also point 22 in SUBMITTING:
http://freegis.org/cgi-bin/viewcvs.cgi/*checkout*/grass6/SUBMITTING

22. If you write a shell script and search for a command in $PATH, do
NOT use the "which" command or the "type -p" command. Both commands
are not supported on all platforms, thus causing problems for some
people.

Out of curiosity, which platforms is this a problem on?
Only really old stuff?

Not really too sure any more. I have a vague memory of having a problem with it some time in the past and then finding that hint in the SUBMITTING file afterwards. Might have been on IRIX.

Paul

One database per location may be the way server-based DBMS attribute storage works, but if the attribute DB files are in the same place as the rest of the GRASS files, I'd rather have one per map.

- Easy to backup a single map, easy to restore a map if you mess it up.

- I'd feel safer also - while sqlite may be rock-solid (I don't know) and provide for recovery, if a one-per-location sqlite DB file gets corrupt, you could lose the whole location.

- Size is another consideration. While modern systems can support HUGE files, that can get cumbersome.

On Nov 14, 2005, at 1:45 AM, Wolf Bergenheim wrote:

Hamish wrote:

2. We might want to have an "sql" directory in each mapset, like we do
for dbf.

Make that a "sqlite" dir, as "sql" is too generic to be meaningful.

Why a directory, why not just call the database file sqlite.db in the location directory. or then give the db the same name as the location, and add the .db extension (; That is the way I have set it up.

This would be the location for a default sqlite database for
each mapset, containing tables for each vector file. The default
database could simple carry the name of the mapset. This does not
preclude the creation and use of other sqlite database in other
locations, of course. 3. GRASS would need to be able to create an
empty sqlite database automatically for each mapset, so that tables
could be added as needed.

Maybe I don't understand sqlite (never used it); why doesn't each map
have its own DB file in the first place? Why does there have to be a
single all-of-mapset one? I can't imagine the overhead per DB is that
huge.

It doesn't work like that. In postgress you also have one DB per location, right? Same in SQLite. One file per database, not per table. Oterwise I don't think that you can do any meaningfull selects etc involving many tables.

-----
William Kyngesburye <kyngchaos@kyngchaos.com>
http://www.kyngchaos.com/

Earth: "Mostly harmless"

- revised entry in the HitchHiker's Guide to the Galaxy

On Mon, Nov 14, 2005 at 09:32:53AM +0000, Paul Kelly wrote:

On Mon, 14 Nov 2005, Hamish wrote:

>>See also point 22 in SUBMITTING:
>>http://freegis.org/cgi-bin/viewcvs.cgi/*checkout*/grass6/SUBMITTING
>>
>>22. If you write a shell script and search for a command in $PATH, do
>>NOT use the "which" command or the "type -p" command. Both commands
>>are not supported on all platforms, thus causing problems for some
>>people.
>
>Out of curiosity, which platforms is this a problem on?
>Only really old stuff?

Not really too sure any more. I have a vague memory of having a problem
with it some time in the past and then finding that hint in the SUBMITTING
file afterwards. Might have been on IRIX.

BTW: what about taking shell stuff out of SUBMITTING and
writing a SUBMITTING_SHELL? This could be then even useful to
teach GRASS shell programming.

Markus