Can QGIS Read Spatialite Views?

I think you have to register the view in geometry_columns table to be able to use it in QGIS.

A good resource is "Hand-writing your own Spatial VIEW" with the following example:

INSERT INTO views_geometry_columns
(view_name, view_geometry, view_rowid, f_table_name, f_geometry_column)
VALUES ('italy', 'geometry', 'ROWID', 'local_councils', 'geometry');

Anyway you must register this VIEW into the views_geometry_columns, so to make it become a real Spatial View.


You may also have to put a unique ID into the view, similar to what is discussed here: In PostGIS is it possible to create a View with a unique ID?


registering the view in geometry_columns nowadays (year 2015) seems to require an additional field 'read_only' like so:

INSERT INTO views_geometry_columns
(view_name, view_geometry, view_rowid, f_table_name, f_geometry_column, read_only )
VALUES ('italy', 'geometry', 'ROWID', 'local_councils', 'geometry', 1);