<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=utf-8">
<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:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Monaco;
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@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="#0563C1" vlink="#954F72" 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">This works:<o:p></o:p></p>
<p class="MsoNormal" style="line-height:13.5pt;background:#2D2A2E"><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">tc_lyr
</span><span style="font-size:9.0pt;font-family:Menlo;color:#FF6188;mso-ligatures:none">=</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">
</span><span style="font-size:9.0pt;font-family:Menlo;color:#A9DC76;mso-ligatures:none">execute_SQL</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">(</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">tree_canopy_mem_ds</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">,</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">
</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">"</span><span style="font-size:9.0pt;font-family:Menlo;color:#FFD866;mso-ligatures:none">select * from trees</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">",</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">
</span><i><span style="font-size:9.0pt;font-family:Menlo;color:#FC9867;mso-ligatures:none">spatialFilter</span></i><span style="font-size:9.0pt;font-family:Menlo;color:#FF6188;mso-ligatures:none">=</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">c_geo)<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">However, this:<o:p></o:p></p>
<p class="MsoNormal" style="line-height:13.5pt;background:#2D2A2E"><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">tc_lyr
</span><span style="font-size:9.0pt;font-family:Menlo;color:#FF6188;mso-ligatures:none">=</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">
</span><span style="font-size:9.0pt;font-family:Menlo;color:#A9DC76;mso-ligatures:none">execute_SQL</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">(</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">tree_canopy_mem_ds</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">,</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">
</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">"</span><span style="font-size:9.0pt;font-family:Menlo;color:#FFD866;mso-ligatures:none">select * from trees</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">",</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">
</span><i><span style="font-size:9.0pt;font-family:Menlo;color:#FC9867;mso-ligatures:none">spatialFilter</span></i><span style="font-size:9.0pt;font-family:Menlo;color:#FF6188;mso-ligatures:none">=</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">c_geo</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">,</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none">
</span><i><span style="font-size:9.0pt;font-family:Menlo;color:#FC9867;mso-ligatures:none">dialect</span></i><span style="font-size:9.0pt;font-family:Menlo;color:#FF6188;mso-ligatures:none">=</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">"</span><span style="font-size:9.0pt;font-family:Menlo;color:#FFD866;mso-ligatures:none">SQLITE</span><span style="font-size:9.0pt;font-family:Menlo;color:#939293;mso-ligatures:none">")</span><span style="font-size:9.0pt;font-family:Menlo;color:#FCFCFA;mso-ligatures:none"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Returns:<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Monaco;color:#FCFCFA;background:#403E41">In Initialize(): sqlite3_step(SELECT _rowid_, * FROM 'trees' LIMIT 1): SQL logic error<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Monaco;color:#FCFCFA;background:#403E41"><o:p> </o:p></span></p>
<p class="MsoNormal">Where execute_SQL = ogr.DataSource.ExecuteSQL<o:p></o:p></p>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">Which is naturally a surprise given that I’m not explicitly asking for the rowid, nor to limit the number of returned rows.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The docs claim that the SQLite dialect can be used with any OGR datasource, so I did expect this to work. The input datasource is GeoPackage, which is based on SQLite, so I assume my install is built with SQLite, though I’d welcome advice
on how to explicitly demonstrate this. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My GDAL version install is 3.6.4, on OSX 13.5.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Jesse<o:p></o:p></p>
</div>
</body>
</html>