Opened 7 years ago
Last modified 6 years ago
#3490 new defect
pygrass: improve error messages for table handling
Reported by: | sbl | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.6.2 |
Component: | Python | Version: | unspecified |
Keywords: | pygrass, vector, SQLite | Cc: | |
CPU: | All | Platform: | All |
Description
When I try to create a new vector map in pygrass where columns in the attribute table (SQLite) contain "." (e.g. "landsatIm.5") new.open() 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> sys.exit(main()) File "/home/NINA.NO/stefan.blumentrath/.grass7/addons/scripts/i.pysptools.unmix", line 272, in main new.open('w', tab_name=endmembers, tab_cols=cols) File "/home/NINA.NO/stefan.blumentrath/grass-7.4.0svn/etc/python/grass/pygrass/vector/abstract.py", 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/table.py", line 1053, in n_rows cur.execute(sql.SELECT.format(cols='Count(*)', tname=self.name)) 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 by , 7 years ago
comment:2 by , 7 years ago
Milestone: | → 7.2.4 |
---|
comment:3 by , 6 years ago
Milestone: | 7.2.4 → 7.6.2 |
---|
Note:
See TracTickets
for help on using tickets.
See also: #3071 regarding effects of not quoting SQL identifiers...