<div dir="ltr"><div>Hi Bo,</div><div><br></div><div>

<p style="margin:0px;text-indent:0px;white-space:pre-wrap">iface.activeLayer().source() should give you what you want.</p><p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p><p style="margin:0px;text-indent:0px;white-space:pre-wrap"><br></p></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 29, 2021 at 2:21 PM Bo Victor Thomsen <<a href="mailto:bo.victor.thomsen@gmail.com">bo.victor.thomsen@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi list -<br>
<br>
I have a (probably totally obvious, stupid) Pyhton question:<br>
<br>
I need the datasource URI string of a maplayer chosen by the user.<br>
<br>
I have found  the QgsMapLayer chosen by the user. And the QgsVectorLayer <br>
associated with the Maplayer.<br>
<br>
How do I find the datasource string associated with the QgsVectorLayer?<br>
<br>
There is oodles of QGIS information about generating a vector layer from <br>
a specific datasource. I need the opposite to generate a virtual layer <br>
in Python using a join between the chosen layer with a another <br>
predefined layer (which I have the datasource string for).<br>
<br>
-- <br>
<br>
Med venlig hilsen / Kind regards<br>
<br>
Bo Victor Thomsen<br>
<br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Alessandro Pasotti</div><div>QCooperative:  <a href="https://www.qcooperative.net" target="_blank">www.qcooperative.net</a><br></div>ItOpen:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div></div>