Martin,

Add the "-oo LIST_ALL_TABLES=YES" open option to your ogrinfo call: https://gdal.org/en/latest/drivers/vector/sqlite.html

(GPKG has a gpkg_contents table where non-spatial layers that are user facing are listed. There is no such thing in "pure" SQLite, and historically the driver has chosen to only list the ones registered in the geometry_columns table)

Even

Le 30/10/2024 à 12:46, Martin Landa via gdal-dev a écrit :
Hi all,

I have problem creating a new layer (no geometry) in SQLite data source:

"""
from osgeo import ogr

driver_name = "SQLite"
filename = "test.db"

driver = ogr.GetDriverByName(driver_name)

with driver.CreateDataSource(filename) as ds:
    layer = ds.CreateLayer("test", geom_type=ogr.wkbNone)
    field = ogr.FieldDefn("label", ogr.OFTString)
    layer.CreateField(field)

    layer_defn = layer.GetLayerDefn()
    feat = ogr.Feature(layer_defn)
    feat.SetField("label", "test")
    layer.CreateFeature(feat)
"""

Created datasource doesn't contain any layer, no errors reported.

When I switch to GPKG driver, everything works fine:

ogrinfo  test.gpkg test
...
OGRFeature(test):1
  label (String) = test

I have GDAL: 3.9.2, do you have any idea what is wrong?

Thanks in advance for your help, best regards, Martin

--
Martin Landa
https://geomatics.fsv.cvut.cz/en/employees/martin-landa/
http://gismentors.cz/mentors/landa

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

--
http://www.spatialys.com
My software is free, but my time generally not.
Butcher of all kinds of standards, open or closed formats. At the end, this is 
just about bytes.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to