stratified_packager.processing.staging
Per-layer staging decisions (SPEC §8.2).
Staging is no longer a correctness requirement. QgsVectorFileWriter
reads a layer through its QGIS provider, so memory providers, joins, virtual/expression
fields and unsaved edits are written directly, and per-stratum matching is computed against
the very layer that is written — the QGIS-fid ↔ OGR-FID equivalence problem that once forced
staging is gone. Staging is now a pure read-amortization optimization: a source read many
times (every whole_export layer, any layer of a STAGE_PROVIDERS provider, or any layer
the user marks) is copied once into a local GeoPackage holding only the features some stratum
uses (or every feature when EXPORT_FULL_PACKAGE is on, since the <full> stratum reads
the whole copy), and every stratum then reads its slice from that fast local copy instead of
re-fetching from a slow source.
The decision is the layer’s tri-state stratified_packager_stage variable: true /
false force it, unset (or auto) stages iff the matching method is whole_export
(the data that lands, identically, in every stratum) or the layer’s data provider is in the
resolved STAGE_PROVIDERS set (a provider the user declared slow enough that every read
beyond the first must hit a local copy). The staging write itself reuses
write_vector_table(); this module only decides.
Functions
|
Resolve whether layer's data is staged into a local GeoPackage (SPEC §8.2). |
|
Build the OGR uri of a staged table, for the algorithm thread's read layer. |
- stratified_packager.processing.staging.effective_stage(layer, *, method, stage_providers)[source]
Resolve whether layer’s data is staged into a local GeoPackage (SPEC §8.2).
The layer’s
stratified_packager_stagevariable is tri-state:true/falseforce the decision; unset (orauto) stages iff method iswhole_export— the layer whose features land, identically, in every stratum — or the layer’s data provider is in stage_providers, the resolvedSTAGE_PROVIDERSset of providers whose layers would otherwise be re-read from a slow source once per stratum.- Parameters:
layer (
QgsVectorLayer) – The packaged vector layer.method (
MatchingMethod) – Its resolved matching method.stage_providers (
Collection[str]) – The resolvedSTAGE_PROVIDERSprovider keys.
- Return type:
- Returns:
Whether the layer is staged.
- Raises:
ValueError – If the variable holds a value that is neither boolean nor
auto.