I am trying to randomly select some points from a shape file using ogr2ogr and an SQL query via sqlite but it seems to baulk at the sqlite version:
ogr2ogr -sql "SELECT * FROM probe_2004to2012 WHERE D2004 > 0 ORDER BY RANDOM() LIMIT 10" -dialect sqlite ./Probing/probe_2004_r10.shp ./Probing/probe_2004to2012.shp
ERROR 6: The SQLite version is to old to support the SQLite SQL dialect
Given that I tried updating sqlite3 in my /usr/bin/ from the jan 2013 version and it is now the latest (Oct 2013) version and ogr2ogr still throws up this error I suspect it may be something else that's wrong. I know I can select random points in QGIS using the "Research Tools" toolbox but I would really like to be able to script this as I have a lot of random selecting to do.
-update: its seems ogr2ogr supports
-dialect sqlite3
as a valid flag and that seems to get a simplified sql query to parse but the random() selection won't get through.
After the discussion below it seems that ogr2ogr is not parsing the -dialect flag "properly". The sqlite3 flag is ignored and ogr defaults to its built in sql, which is why the simple queries work. Why the sqlite flag is coming up ERROR 6 I don't know. Yet.