Hi all,
I tried to import a polygon shape, specifically the HydroBASINS from hydrosheds.org however I got following error:
v.import input=/…/Hydrosheds/hybas_na_lev00_v1c/hybas_na_lev00_v1c.shp layer=hybas_na_lev00_v1c output=hybas_na_lev00_v1c
WARNING: All available OGR layers will be imported into vector map <hybas_na_lev00_v1c>
Check if OGR layer <hybas_na_lev00_v1c> contains polygons…
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near “ORDER”: syntax error
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near “ORDER”: syntax error
ERROR: Unable to create table: ‘create table hybas_na_lev00_v1c (cat integer, HYBAS_ID double precision, NEXT_DOWN double precision, NEXT_SINK double precision, MAIN_BAS double precision, DIST_SINK double precision, DIST_MAIN double precision, SUB_AREA double precision, UP_AREA double precision, ENDO integer, COAST integer, ORDER integer, SORT double precision, PFAF_1 integer, PFAF_2 integer, PFAF_3 integer, PFAF_4 integer, PFAF_5 integer, PFAF_6 integer, PFAF_7 integer, PFAF_8 integer, PFAF_9 integer, PFAF_10 double precision, PFAF_11 double precision, PFAF_12 double precision)’
ERROR: Unable to import </…/Hydrosheds/hybas_na_lev00_v1c/hybas_na_lev00_v1c.shp>
So I guess ORDER is a sqlite specific word that is reserved for SQL operations and is not allowed as column name? Is this a general thing of sqlite or is this just related to v.import/v.in.ogr and the creation of the sqlite table?
cheers,
Johannes
Le 16 mai 2017 22:16:03 GMT+02:00, Johannes Radinger <johannesradinger@gmail.com> a écrit :
Hi all,
I tried to import a polygon shape, specifically the HydroBASINS from
hydrosheds.org however I got following error:
v.import
input=/.../Hydrosheds/hybas_na_lev00_v1c/hybas_na_lev00_v1c.shp
layer=hybas_na_lev00_v1c output=hybas_na_lev00_v1c
WARNING: All available OGR layers will be imported into vector map
<hybas_na_lev00_v1c>
Check if OGR layer <hybas_na_lev00_v1c> contains polygons...
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near "ORDER": syntax error
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near "ORDER": syntax error
ERROR: Unable to create table: 'create table hybas_na_lev00_v1c (cat
integer, HYBAS_ID double precision, NEXT_DOWN double precision,
NEXT_SINK
double precision, MAIN_BAS double precision, DIST_SINK double
precision,
DIST_MAIN double precision, SUB_AREA double precision, UP_AREA double
precision, ENDO integer, COAST integer, ORDER integer, SORT double
precision, PFAF_1 integer, PFAF_2 integer, PFAF_3 integer, PFAF_4
integer,
PFAF_5 integer, PFAF_6 integer, PFAF_7 integer, PFAF_8 integer, PFAF_9
integer, PFAF_10 double precision, PFAF_11 double precision, PFAF_12
double
precision)'
ERROR: Unable to import
</.../Hydrosheds/hybas_na_lev00_v1c/hybas_na_lev00_v1c.shp>
So I guess ORDER is a sqlite specific word that is reserved for SQL
operations and is not allowed as column name? Is this a general thing
of
sqlite or is this just related to v.import/v.in.ogr and the creation of
the
sqlite table?
AFAIK, ORDER is a general SQL reserved keyword, not only in Sqlite. See [1] for example.
Moritz
[1] http://www.sql.org/sql-database/postgresql/manual/sql-keywords-appendix.html
Thank you Moritz,
that’s what I thought. So I’ll try the ‘columns’ option in v.in.ogr to rename the columns during import.
/johannes
···
On Tue, May 16, 2017 at 11:50 PM, Moritz Lennert <mlennert@club.worldonline.be> wrote:
Le 16 mai 2017 22:16:03 GMT+02:00, Johannes Radinger <johannesradinger@gmail.com> a écrit :
Hi all,
I tried to import a polygon shape, specifically the HydroBASINS from
hydrosheds.org however I got following error:
v.import
input=/…/Hydrosheds/hybas_na_lev00_v1c/hybas_na_lev00_v1c.shp
layer=hybas_na_lev00_v1c output=hybas_na_lev00_v1c
WARNING: All available OGR layers will be imported into vector map
<hybas_na_lev00_v1c>
Check if OGR layer <hybas_na_lev00_v1c> contains polygons…
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near “ORDER”: syntax error
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near “ORDER”: syntax error
ERROR: Unable to create table: ‘create table hybas_na_lev00_v1c (cat
integer, HYBAS_ID double precision, NEXT_DOWN double precision,
NEXT_SINK
double precision, MAIN_BAS double precision, DIST_SINK double
precision,
DIST_MAIN double precision, SUB_AREA double precision, UP_AREA double
precision, ENDO integer, COAST integer, ORDER integer, SORT double
precision, PFAF_1 integer, PFAF_2 integer, PFAF_3 integer, PFAF_4
integer,
PFAF_5 integer, PFAF_6 integer, PFAF_7 integer, PFAF_8 integer, PFAF_9
integer, PFAF_10 double precision, PFAF_11 double precision, PFAF_12
double
precision)’
ERROR: Unable to import
</…/Hydrosheds/hybas_na_lev00_v1c/hybas_na_lev00_v1c.shp>
So I guess ORDER is a sqlite specific word that is reserved for SQL
operations and is not allowed as column name? Is this a general thing
of
sqlite or is this just related to v.import/v.in.ogr and the creation of
the
sqlite table?
AFAIK, ORDER is a general SQL reserved keyword, not only in Sqlite. See [1] for example.
Moritz
[1] http://www.sql.org/sql-database/postgresql/manual/sql-keywords-appendix.html