I have a processing script (QGIS 3.12) that extracts values from an input table using the native:extractbyattribute algorithm. This produces a temporary output table with the display name 'Extracted (attribute) and I would like to rename this to something more meaningful within the script.
I can get the unique name of the layer with:
extracted = processing.run('native:extractbyattribute', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
layer = QgsProcessingUtils.mapLayerFromString(format(extracted['OUTPUT']), context )
but I can't see how to set the display name programmatically within the script. The layer is of type QgsVectorLayer. I can get its attributes with layer.dataProvider(), but this does not include a name attribute.
There are several ways to iterate through the layers from the console, but no information on how to do this through a script.