[GRASS-user] GRASS 7.2 v.in.ascii error

Hi all!

I’m using GRASS 7.2 on Ubuntu 16.04 LTS trying to import a csv file that looks like this:

2017-01-15T16:47:29.070Z,36.4586667,-83.0818333,22.74,2.58,md,24,69,0.2334,0.11,se,se60172026,2017-01-18T00:59:44.532Z,“8km NW of Rogersville, Tennessee”,earthquake,0.24,0.55,0.107,14,reviewed,se,se
2016-12-13T11:37:31.220Z,35.7103333,-82.8548333,6.08,2.59,md,30,43,0.05349,0.15,se,se60141742,2017-01-18T09:14:07.040Z,“18km NE of Cove Creek, North Carolina”,earthquake,0.2,0.5,0.048,23,reviewed,se,se
2016-10-30T04:01:47.390Z,35.619,-84.2315,9.7,2.56,md,30,52,0.06166,0.19,se,se60163691,2016-12-01T06:52:36.040Z,“3km NNE of Vonore, Tennessee”,earthquake,0.31,0.5,0.09,17,reviewed,se,se
2016-10-25T02:42:50.480Z,35.8158333,-84.0938333,3.32,2.7,md,31,36,0.1557,0.25,se,se60163236,2016-12-07T22:23:49.040Z,“4km W of Louisville, Tennessee”,earthquake,0.41,1.25,0.123,18,reviewed,se,se
2016-09-26T06:05:04.530Z,35.3206667,-84.5148333,5.56,2.54,md,27,51,0.04922,0.14,se,se60134497,2016-12-14T03:17:50.040Z,“0km ESE of Etowah, Tennessee”,earthquake,0.26,0.33,0.086,12,reviewed,se,se
2016-09-07T00:07:27.880Z,35.8961667,-83.681,23.79,2.53,md,21,59,0.08793,0.18,se,se60158301,2016-12-03T02:54:46.040Z,“5km ENE of Seymour, Tennessee”,earthquake,0.31,0.6,0.192,13,reviewed,se,se
2016-07-18T09:53:39.560Z,37.1892,-81.8317,0,3.7,mwr,0.83,us,us20006fi5,2016-09-17T01:27:49.040Z,“11km NNW of Richlands, Virginia”,mine collapse,3.5,2,30,reviewed,nm,slm
2016-06-17T14:38:15.320Z,35.3501667,-84.8731667,17.96,2.59,md,33,53,0.2193,0.13,se,se60147326,2016-08-27T02:15:26.040Z,“12km N of Hopewell, Tennessee”,earthquake,0.2,0.57,0.146,19,reviewed,se,se
2016-05-08T09:09:55.970Z,36.1145,-83.7825,16.13,2.65,md,27,50,0.08996,0.16,se,se60115062,2016-07-20T18:10:48.040Z,“6km NNW of Mascot, Tennessee”,earthquake,0.26,0.51,0.076,17,reviewed,se,se
2016-04-25T14:43:29.760Z,35.7528333,-82.5716667,4.25,2.53,md,28,47,0.2129,0.26,se,se60025303,2016-07-08T02:49:22.040Z,“6km N of Weaverville, North Carolina”,earthquake,0.4,1.05,0.059,12,reviewed,se,se
2016-04-25T08:00:11.710Z,35.3116667,-84.2303333,17.32,2.54,md,35,54,0.1843,0.16,se,se60138746,2016-07-08T02:49:21.040Z,“26km SSE of Madisonville, Tennessee”,earthquake,0.25,0.64,0.083,19,reviewed,se,se

in v.in.ascii my column definition is:

time varchar(30),latitude double precision,longitude double precision,depth double precision,mag double precision,magType varchar(4),nst int,gap int,dmin double precision,rms double precision,net varchar(4),id varchar(20),updated varchar(30),place varchar(50),type varchar(20),horizontalError double precision,depthError double precision,magError double precision,magNst int,status varchar(20),locationSource varchar(4),magSource varchar(4)

So, the command line looks like this:

v.in.ascii input=/home/teaiii/Downloads/earthquake_query.csv output=earthquakes separator=comma columns=“time varchar(30),latitude double precision,longitude double precision,depth double precision,mag double precision,magType varchar(4),nst int,gap int,dmin double precision,rms double precision,net varchar(4),id varchar(20),updated varchar(30),place varchar(50),type varchar(20),horizontalError double precision,depthError double precision,magError double precision,magNst int,status varchar(20),locationSource varchar(4),magSource varchar(4)” x=3 y=2 z=4 cat=0

I’m getting this error:

(Thu Jan 19 13:05:13 2017)
v.in.ascii input=/home/teaiii/Downloads/earthquake_query.csv output=earthquakes separator=comma columns=time varchar(30),latitude double precision,longitude double precision,depth double precision,mag double precision,magType varchar(4),nst int,gap int,dmin double precision,rms double precision,net varchar(4),id varchar(20),updated varchar(30),place varchar(50),type varchar(20),horizontalError double precision,depthError double precision,magError double precision,magNst int,status varchar(20),locationSource varchar(4),magSource varchar(4) x=3 z=4
Scanning input for column types…
Number of columns: 22
Number of rows: 429
DBMI-DBF driver error:
SQL parser error (syntax error, unexpected TIME, expecting
NAME processing ‘time’) in statement:
create table earthquakes ( cat integer, time
varchar(30),latitude double precision,longitude double
precision,depth double precision,mag double
precision,magType varchar(4),nst int,gap int,dmin double
precision,rms double precision,net varchar(4),id
varchar(20),updated varchar(30),place varchar(50),type
varchar(20),horizontalError double precision,depthError
double precision,magError double precision,magNst int,status
varchar(20),locationSource varchar(4),magSource varchar(4) )
Unable to execute statement.
DBMI-DBF driver error:
SQL parser error (syntax error, unexpected TIME, expecting
NAME processing ‘time’) in statement:
create table earthquakes ( cat integer, time
varchar(30),latitude double precision,longitude double
precision,depth double precision,mag double
precision,magType varchar(4),nst int,gap int,dmin double
precision,rms double precision,net varchar(4),id
varchar(20),updated varchar(30),place varchar(50),type
varchar(20),horizontalError double precision,depthError
double precision,magError double precision,magNst int,status
varchar(20),locationSource varchar(4),magSource varchar(4) )
Unable to execute statement.
ERROR: Unable to create table: create table earthquakes ( cat integer, time varchar(30),latitude double precision,longitude double precision,depth double precision,mag double precision,magType varchar(4),nst int,gap int,dmin double precision,rms double precision,net varchar(4),id varchar(20),updated varchar(30),place varchar(50),type varchar(20),horizontalError double precision,depthError double precision,magError double precision,magNst int,status varchar(20),locationSource varchar(4),magSource varchar(4) )
WARNING: Table linked to vector map does not exist
(Thu Jan 19 13:05:13 2017) Command finished (0 sec)

Any thoughts?

Best,

Tom

SQL parser error (syntax error, unexpected TIME, expecting
NAME processing 'time') in statement:

Could it be that time is a SQL reserved word/key? Try another word instead
of 'time'.

HTH
Helmut

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GRASS-7-2-v-in-ascii-error-tp5304079p5304089.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Helmut,

Thank you; I did try ‘date’ and got the same result using the exact dataset. After sending out the email (thinking GRASS might be choking on the number of columns), I reduced the number of columns and re-ordered them (thinking that maybe the ID ought to come first – also recognizing that this should NOT be the case). I got the same error – then, I did as you have suggested, using ‘datetime’ instead of ‘time’ – this worked. So, it almost certainly was the use of ‘time’ or ‘date’ as a column name…

At some point I’ll go back to the original dataset to verify this.

Thank you…

Best,

Tom

···

On Thu, Jan 19, 2017 at 3:27 PM, Helmut Kudrnovsky <hellik@web.de> wrote:

SQL parser error (syntax error, unexpected TIME, expecting
NAME processing ‘time’) in statement:

Could it be that time is a SQL reserved word/key? Try another word instead
of ‘time’.

HTH
Helmut


best regards
Helmut

View this message in context: http://osgeo-org.1560.x6.nabble.com/GRASS-7-2-v-in-ascii-error-tp5304079p5304089.html
Sent from the Grass - Users mailing list archive at Nabble.com.


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Hi,

2017-01-20 13:15 GMT+01:00 Thomas Adams <tea3rd@gmail.com>:

Thank you; I did try 'date' and got the same result using the exact dataset.

well, 'date' is also SQL reserved word :slight_smile: [1] Ma

[1] http://developer.mimer.se/validator/sql-reserved-words.tml

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Martin,

Yes; I pretty much figured that out – ‘datetime’ worked. I’m slowly catching on…

Tom

···

On Fri, Jan 20, 2017 at 7:18 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2017-01-20 13:15 GMT+01:00 Thomas Adams <tea3rd@gmail.com>:

Thank you; I did try ‘date’ and got the same result using the exact dataset.

well, ‘date’ is also SQL reserved word :slight_smile: [1] Ma

[1] http://developer.mimer.se/validator/sql-reserved-words.tml


Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Thomas E Adams, III
1724 Sage Lane
Blacksburg, VA 24060
tea3rd@gmail.com (personal)
tea@terrapredictions.org (work)

1 (513) 739-9512 (cell)