[GRASS-dev] How to calculate log() in v.db.update with SQLite backend?

Markus Neteler neteler at osgeo.org
Tue Nov 18 13:34:39 PST 2014


Hi,

playing around with the "Meuse" dataset about soil contamination I
attempted to calculate that right away but...:

v.db.update meuse_voronoi column="logzinc" qcolumn="log(zinc)"
DBMI-SQLite driver error:
Error in sqlite3_prepare():
no such function: log

DBMI-SQLite driver error:
Error in sqlite3_prepare():
no such function: log

ERROR: Error while executing: 'UPDATE meuse_voronoi SET logzinc=log(zinc)'

After some online research I found that I would need to tune my local
SQLite installation with

https://sqlite.org/contrib/download/extension-functions.c
"extension-functions.c (50.96 KB) contributed by Liam Healy on
2010-02-06 15:45:07
Provide mathematical and string extension functions for SQL queries
using the loadable extensions mechanism. Math: acos, asin, atan, atn2,
atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin,
tan, cot, cosh, sinh, tanh, coth, exp, log, log10, power, sign, sqrt,
square, ceil, floor, pi. String: replicate, charindex, leftstr,
rightstr, ltrim, rtrim, trim, replace, reverse, proper, padl, padr,
padc, strfilter. Aggregate: stdev, variance, mode, median,
lower_quartile, upper_quartile.
"

Alternative: use pysqlite and define an own function.

Which way to go?

thanks
Markus


More information about the grass-dev mailing list