Bug report #14981
Import of Shapefile to Geopackage-Database in DB-Manager fails
|Affected QGIS version:||2.14.1||Regression?:||No|
|Operating System:||Windows||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||duplicate|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||22930|
If I try to import a SHP into an existing Geopackage-Database with DB-Manager the following error occurs:
"Error 11 Connection to database failed" - although the GPKG-Database is connected in DB-Manager and existing data viewable.
#3 Updated by Even Rouault over 4 years ago
There are 2 issues :
- DlgImportVector.accept() calls QgsVectorLayerImport.importLayer() with providerName = 'spatialite', but the spatialite provider doesn't support GPKG. This could be tweaked to route to the ogr provider
- However QgsOgrProvider::createEmptyLayer() (and QgsOgrProvider constructor) doesn't accept database style URI (with dbname, table parameters), and doesn't accept creating a new layer into an existing datasource. I'm not sure adding this capability in feature freeze is appropriate ?
#4 Updated by Tim Sutton about 4 years ago
- File qgis.gif added
I could replicate the issue here as well although I am not sure if it is the same error others get.
See attached gif for the workflow I tried:
2016-07-06T08:30:05 1 Traceback (most recent call last): File "/Users/timlinux/dev/cpp/QGIS/build-QGIS-QGIS_Build_Kit-Default/output/python/plugins/db_manager/db_tree.py", line 103, in newConnection self.mainWindow.invokeCallback(item.addConnectionActionSlot, index) File "/Users/timlinux/dev/cpp/QGIS/build-QGIS-QGIS_Build_Kit-Default/output/python/plugins/db_manager/db_manager.py", line 288, in invokeCallback callback(self.tree.currentItem(), self.sender(), self, *params) File "/Users/timlinux/dev/cpp/QGIS/build-QGIS-QGIS_Build_Kit-Default/output/python/plugins/db_manager/db_plugins/spatialite/plugin.py", line 102, in addConnectionActionSlot index.internalPointer().itemChanged.emit() AttributeError: 'function' object has no attribute 'emit'
I think that since GeoPackage support is 'the way of the future' we should fix this if we can before the release (I would not consider it a new feature). In the DB Manager the database connection group is 'Spatialite/GeoPackage' which implies for the user that GeoPackage imports should work.
#5 Updated by Anita Graser about 4 years ago
Tim Sutton wrote:
In the DB Manager the database connection group is 'Spatialite/GeoPackage' which implies for the user that GeoPackage imports should work.
+1 It does not work in the 2.16 release now.
Is there any other way within QGIS to add a table to an existing GeoPackage?
(Is this issue really Windows-only?)