[gdal-dev] How retrieve the list of field of a table on spatialite in pythonlang.

Andrea Peri aperi2007 at gmail.com
Fri Jul 4 07:02:09 PDT 2014


Hi Even,
thx for response.

I found the problem.
Was a my error .
I'm quite new-by on python.

You response help me to understand that the error was mine.

Regards,

Andrea.


2014-07-03 20:59 GMT+02:00 Even Rouault <even.rouault at mines-paris.org>:
> Le jeudi 03 juillet 2014 18:01:09, Andrea Peri a écrit :
>> Hi,
>>
>> I'm try-ing to retrieve the list of fieldname from a spatialite table.
>> To do this I try this code:
>>
>> dataset = "select * from table1"
>> ds = driver.Open(file,False)
>> layer = ds.ExecuteSQL(dataset,None,"SQLITE")
>> layer.ResetReading()
>> layerDef = layer.GetLayerDefn()
>> .....
>>
>> In the last line I'm having an error.
>
> Andrea,
>
> Which error ? I've just tried on a spatialite db and it works fine.
>
>>
>> Is the comand "GetLayerDefn" available on sqlite driver ?
>
> Yes, in all drivers. As soon as you have a non null layer object, you can call
> GetLayerDefn().
>
> Even
>
> --
> Geospatial professional services
> http://even.rouault.free.fr/services.html



-- 
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------


More information about the gdal-dev mailing list