I'm new to SpatiaLite and PyQGIS.
I would like to upload a layer from SpatiaLite database. To do this, I tried with this code:
database = r"C:\sqlite\db.sqlite"
uri = QgsDataSourceUri()
uri.setDatabase(database)
schema = ''
table = 'table_name'
geom_column = 'point'
uri.setDataSource(schema, table, geom_column)
display_name = 'table_name'
vlayer = QgsVectorLayer(uri.uri(), display_name, 'spatialite')
QgsProject.instance().addMapLayer(vlayer)
But this doesn't work, the program says:
Unavailable layer! Layer datasource could not be found
I think the problem may be the value of "geom_column". The table has a column called "the_geo", where the row values are POINT(x_value, y_value).
Can you help me?
geom_column = 'point'withgeom_column = 'the_geo'?