<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Aptos;
        panose-1:2 11 0 4 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Aptos",sans-serif;
        mso-ligatures:standardcontextual;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Aptos",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:11.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Trying to remove superfluous intermediate layers in a GPKG dataset.  The general logic is<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Ds = ogr.open(fp)<o:p></o:p></p>
<p class="MsoNormal">Lyr = ds.executesql(query)<o:p></o:p></p>
<p class="MsoNormal">Ds.DeleteLayer(idx) <- failed, database table is locked, may be caused by “sqlite3_exec(DROP TABLE “rtree_layername_geom”) failed: database table is locked<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is layer deletion not supported while a “result set” from a SQL query is on the dataset is active?  Perhaps importantly, the query sources the deleted layer.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">GDAL v3.9.3<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;mso-ligatures:none">Best,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;mso-ligatures:none">Jesse<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;mso-ligatures:none"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;mso-ligatures:none">Lead Computer Scientist<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;mso-ligatures:none">Science Systems and Applications, Inc.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;mso-ligatures:none">Dr Compton Tucker Team<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt;mso-ligatures:none">NASA Goddard Space Flight Center</span><o:p></o:p></p>
</div>
</body>
</html>