[gdal-dev] Closing connection in Python gdal (too many clients already)
Even Rouault
even.rouault at spatialys.com
Tue Aug 2 00:42:56 PDT 2016
Salut Yves,
>
> I am using gdal 2.1.1 in python.
>
> When I import several layers into postgis I get a FATAL error : 'sorry, too
> many clients already'. It seems I don't close the connection after each
> import.
>
> I open the connection with dstDS = gdal.OpenEx(connectionString). how can I
> close the connexion? I can't find any method
You just need to drop any reference to the dataset, so, assuming it is not
assigned to another variable, with dstDS = None or del dstDS.
See the "Saving and closing datasets/datasources" section at
https://trac.osgeo.org/gdal/wiki/PythonGotchas
Note: assuming you import layers from the same database, it will be (a tiny
bit) more efficient if you re-use the same dataset object.
Even
> PS : I send this question yesterday afternoon on IRC, but I had to leave
> before to get any answer. My apologies if you already answered,
IRC logs are archived at http://irclogs.geoapt.com/gdal/
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list