[GRASS-dev] db.join script wanted

Paulo van Breugel p.vanbreugel at gmail.com
Wed Mar 9 08:53:27 PST 2016


Thanks, db.join table=test1 column=A other_table=test2 other_column=A 
now works. When trying to link the two tables on column B and C, it 
doesn't, which is because both tables have a column A.

GRASS 7.1.svn (AEA):~ > db.join table=test1 column=B other_table=test2 other_column=C
WARNING: SQLite driver: unable to parse decltype: REAL(20)
WARNING: SQLite driver: unable to parse decltype: REAL(20)
WARNING: SQLite driver: column 'C', SQLite type 2 is not supported
WARNING: SQLite driver: unable to parse decltype: REAL(20)
WARNING: SQLite driver: unable to parse decltype: REAL(20)
WARNING: SQLite driver: column 'C', SQLite type 2 is not supported
DBMI-SQLite driver error:
Error in sqlite3_prepare():
duplicate column name: A

DBMI-SQLite driver error:
Error in sqlite3_prepare():
duplicate column name: A

ERROR: Error while executing: 'ALTER TABLE test1 ADD COLUMN A INTEGER(20)'
ERROR: Unable to add column <A>.

The warnings were not shown when linking via columns A, so I assume they 
are not a problem? As for the problem with the duplicate column name, 
would it be possible to add the option to define a prefix which is added 
to the column of the second table if a column with the same name exists 
in the first table (with a default prefix if none is given by the user)?


On 09-03-16 17:30, Markus Neteler wrote:
>
>
> On Mar 9, 2016 5:25 PM, "Paulo van Breugel" <p.vanbreugel at gmail.com 
> <mailto:p.vanbreugel at gmail.com>> wrote:
> >
> > Hoi Markus
> >
> > Still not there via g.extension, but I copied the script to the 
> script folder.
> >
> > I tried with two tables (both created in an external sqlite editor),
> >
> > Table 1: columns A (integer, key) and B (float)
> > Table 2: columns A (integer, key) and C (float)
> >
> > First observation: using the GUI, the drop down menu for the 
> identifier column shows the column names of Table 1 instead of Table 2.
>
> Mhh, perhaps I mixed something up there.
>
> > I tried to link the two on the first columns and on the second 
> columns. In both cases I got an error message, copied below:
> >
> > db.join table=test1 column=A other_table=test2 other_column=A
> >
> > Traceback (most recent call last):
> >
> >   File "/home/paulo/.grass7/addons/scripts/db.join", line 170, in 
> <module>    sys.exit(main())
> >
> >   File "/home/paulo/.grass7/addons/scripts/db.join", line 152, in 
> main columns=colspec)
> >
> >   File 
> "/usr/local/grass7/grass-7.1.svn/etc/python/grass/script/core.py", 
> line 408, in run_command ps = start_command(*args, **kwargs)
> >
> >   File 
> "/usr/local/grass7/grass-7.1.svn/etc/python/grass/script/core.py", 
> line 377, in start_command return Popen(args, **popts)
> >
> >   File 
> "/usr/local/grass7/grass-7.1.svn/etc/python/grass/script/core.py", 
> line 74, in __init__ subprocess.Popen.__init__(self, args, **kwargs)
> >
> >   File "/usr/lib/python2.7/subprocess.py", line 710, in __init__  
> errread, errwrite)
> >
> >   File "/usr/lib/python2.7/subprocess.py", line 1327, in 
> _execute_child raise child_exception
> >
> > OSError: [Errno 2] No such file or directory
>
> That one I fixed 30min ago or so in Svn.
>

Works now

> Please check again.
>
> Markus
>
> > Paulo
> >
> >
> >
> > On 09-03-16 14:02, Markus Neteler wrote:
> >>
> >>
> >> On Mar 9, 2016 1:36 PM, "Paulo van Breugel" <p.vanbreugel at gmail.com 
> <mailto:p.vanbreugel at gmail.com>> wrote:
> >>
> >> ...
> >> > It is in svn I saw, but it doesn't show up in g.extension.. 
> perhaps because I am on 7.1?
> >>
> >> This does not matter. I didn't yet add it to the parent Make file 
> because it is not ready.
> >>
> >> Just take it from trac/svn from now...
> >>
> >> Markus
> >
> >
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20160309/bdd0a57e/attachment-0001.html>


More information about the grass-dev mailing list