I have a table in Memory from a cx_Oracle query (a list of rows, and a list of field names and their types) in my python plugin and I want to load it as a geometry-less layer (Attribute table) in qgis. Which data Provider will Support that?
QgsOracleProvider has a constructor that Returns false, disconnects and sets valid to False if the table queried has no geometry column.
QgsMemoryProvider only allows Point, Linestring, Multipoint, MultilineString, and Multipolygon geometries. Any other geometry is interpreted as WKBUnknown, which causes the QgsMemoryProvider.isValid()
to return False. If I cheat and create a QgsVectorLayer("Point", "myLayerName", "memory")
, and add features with no geometries, then I get a seg fault when I add the layer to the map layer registry. Also important to note, is that when a layer is imported using QgsMemoryProvider, it is not possible to Join against it (A Join from the layer does work.) Since mostly people want to load non-geometric tables into Qgis in order to join them to an existing vector, this reduces the Memory provider's suitability for non geometric tables. (Unless I am wrong. I would be delighted to be wrong.)
QgsDelimitedTextProvider requires an Input file, and I would much rather not write out a csv to the file and then Import it again when I already have the data. But maybe I have to?
Thanks