Opened 2 years ago

Last modified 11 months ago

#3490 new defect

pygrass: improve error messages for table handling

Reported by: sbl Owned by: grass-dev@…
Priority: normal Milestone: 7.6.2
Component: Python Version: unspecified
Keywords: pygrass, vector, SQLite Cc:
CPU: All Platform: All


When I try to create a new vector map in pygrass where columns in the attribute table (SQLite) contain "." (e.g. "landsatIm.5") fails saying first that table exisits and then that it does not exist:

Traceback (most recent call last):
  File "/home/NINA.NO/stefan.blumentrath/.grass7/addons/scripts/i.pysptools.unmix", line 329, in <module>
  File "/home/NINA.NO/stefan.blumentrath/.grass7/addons/scripts/i.pysptools.unmix", line 272, in main'w', tab_name=endmembers, tab_cols=cols)
  File "/home/NINA.NO/stefan.blumentrath/grass-7.4.0svn/etc/python/grass/pygrass/vector/", line 381, in open
    self.n_lines = self.table.n_rows()
  File "/home/NINA.NO/stefan.blumentrath/grass-7.4.0svn/etc/python/grass/pygrass/vector/", line 1053, in n_rows
sqlite3.OperationalError: no such table: test_end

However, after a bit of troubleshooting, I realized that the dots were causing the issue. Would be helpful if pygrass could check for "GRASS compliant" column names and give more specific error messages. An alternative could be to support quoted identifiers throughout the code, but that is probably a too big effort (or something for GRASS 8?)...

Change History (3)

comment:1 Changed 2 years ago by sbl

See also: #3071 regarding effects of not quoting SQL identifiers...

comment:2 Changed 2 years ago by martinl

Milestone: 7.2.4

comment:3 Changed 11 months ago by sbl

Note: See TracTickets for help on using tickets.