Hi,

When the SQLite dialect is used, a temporary SQLite database is created. 
OBJECTID is a feature identifier (FID) and I guess that the FID gets converted 
into a primary key with the SQLite defaults. So maybe you can find the OBJECTID 
from ROWID.
I made a simple test and at least this command did find the right feature. 
Remember that it was just a quick experiment and I did not say that it is 
reliable.

ogrinfo poly_sdk.gdb -sql "select rowid, shape from poly where rowid=10" 
-dialect sqlite

-Jukka Rahkonen-


Lähettäjä: gdal-dev <gdal-dev-boun...@lists.osgeo.org> Puolesta andy
Lähetetty: perjantai 1. syyskuuta 2023 0.36
Vastaanottaja: gdal dev <gdal-dev@lists.osgeo.org>
Aihe: [gdal-dev] sqlite dialect: OpenFileGDB and FID Column selection

Hi,
if I run

ogr2ogr -f CSV /vsistdout/ data.gdb  -sql "
SELECT OBJECTID from table_EDF_IS limit 1"
I have

OBJECTID,
"1"

Instead, if I run

ogr2ogr -f CSV /vsistdout/ data.gdb  -dialect sqlite  -sql "
SELECT OBJECTID from  table_EDF_IS   limit 1"

I have this error

ERROR 1: In ExecuteSQL(): sqlite3_prepare_v2(SELECT OBJECTID from  table_EDF_IS 
  limit 1): no such column: OBJECTID

What's the way to use sqlite dialect and select OBJECTID/FID field?
If I use ogrinfo I have "FID Column = OBJECTID"

I'm using GDAL 3.8.0dev-c95490018a, released 2023/07/21

Thank you,

Andrea

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to