geofileops.options.set_copy_layer_sqlite_direct#

static options.set_copy_layer_sqlite_direct(enable: bool | None) _RestoreOriginalHandler#

Enable option to copy data directly in SQLite in copy_layer when possible.

If not set, this option is enabled by default.

This can be significantly faster than having the data pass through GDAL for large datasets.

It is only applied if several conditions are met:

  • only used for Geopackage files

  • only write_mode=”append”

  • only if explodecollections=False

  • only if reprojection=False

Remarks:

  • You can also set the option temporarily by using this function as a context manager.

  • You can also set the option by directly setting the environment variable GFO_COPY_LAYER_SQLITE_DIRECT to “TRUE” or “FALSE”.

Added in version 0.11.0.

Parameters:

enable (bool | None) – If True, this option is enabled. If None, the option is unset (so the default behavior is used).

Examples

If you want to change the default value of the option in general, you can just call it as a function:

gfo.options.set_copy_layer_sqlite_direct(False)

If you want to temporarily change the option, you can use it as a context manager:

with gfo.options.set_copy_layer_sqlite_direct(False):
    gfo.copy_layer(...)