2

I am use this code to load a layer from ArcSDE SQL Server database, but it only loads a table.

uri = QgsDataSourceURI()
uri.setConnection("localhost","", "arcsde", "sa", "****")
uri.setDataSource('dbo','Shelter',"geom")
vlayer = QgsVectorLayer(uri.uri(), "Shelter", "mssql")
QgsMapLayerRegistry.instance().addMapLayer(vlayer)

I try to use the follow code,it's can load layer from SQL server,but it can be edited,why? uri = "MSSQL:server=localhost;database=arcsde;tables=dbo.SHELTER;trusted_connection=yes" vlayer = QgsVectorLayer(uri, u"shelter", "ogr") QgsMapLayerRegistry.instance().addMapLayer(vlayer)

  • Please edit the question to specify the geometry storage format of your enterprise geodatabase feature class, and the version of ArcGIS in use. – Vince Dec 16 '16 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.