示例#1
0
def getDBLayerPrimaryKey(layer):
    uri = QgsDataSourceUri(layer.dataProvider().dataSourceUri())
    return uri.key()