gdal
gdal copied to clipboard
Parameters for SQL files
Starting from ogr2ogr 2.1 it is possible to use as query a pointer to a text file "-sql @query.sql". It would be useful to be able to put some placeholder in the query and pass some additional argument to set their values.
For example,
$ cat query.sql
SELECT * FROM table WHERE id BETWEEN ? AND ?
$ ogr2ogr -sql @query.sql -sql-arg 42 -sql-arg 9999[...]
generates the same output of
$ ogr2ogr -sql "SELECT * FROM table WHERE id BETWEEN 42 AND 9999" [...]
Of course, named arguments could be more useful for complex queries, especially when the same argument should be put in several places.
A very old feature request, would be great to be implemented!