Class: QgsVectorLayerJoinInfo¶
- class qgis.core.QgsVectorLayerJoinInfo¶
Bases:
sip.wrapper
Defines left outer join from our vector layer to some other vector layer. The join is done based on [our layer].targetField = [join layer].joinField
New in version 3.0.
QgsVectorLayerJoinInfo() Constructor for QgsVectorLayerJoinInfo.
QgsVectorLayerJoinInfo(
QgsVectorLayerJoinInfo
)Methods
Extract the join feature from the target feature for the current join layer information.
Returns whether a feature deleted on the target layer has to impact the joined layer by deleting the corresponding joined feature.
Returns
True
if blocklisted fields is not empty or if a subset of names has been set.Returns whether a feature created on the target layer has to impact the joined layer by creating a new feature if necessary.
Returns whether the form has to be dynamically updated with joined fields when a feature is being created in the target layer.
Returns whether joined fields may be edited through the form of the target layer.
Returns whether values from the joined layer should be cached in memory to speed up lookups.
Returns name of the field of joined layer that will be used for join
Returns the list of fields to ignore.
Returns the list of fields to ignore.
Returns the list of field names to use for joining considering blocklisted fields and subset.
Returns joined layer (may be
None
if the reference was set by layer ID and not resolved yet)ID of the joined layer - may be used to resolve reference to the joined layer
Returns prefix of fields from the joined layer.
Returns the prefixed name of the field.
Sets whether a feature deleted on the target layer has to impact the joined layer by deleting the corresponding joined feature.
Sets whether the form has to be dynamically updated with joined fields when a feature is being created in the target layer.
Sets whether the form of the target layer allows editing joined fields.
Sets name of the field of joined layer that will be used for join
Sets a list of fields to ignore whatever happens.
Sets a
list
of fields to ignore whatever happens.Sets the subset of fields to be used from joined layer.
Sets weak reference to the joined layer
Sets ID of the joined layer.
Sets prefix of fields from the joined layer.
Sets name of the field of our layer that will be used for join
Sets whether a feature created on the target layer has to impact the joined layer by creating a new feature if necessary.
Sets whether values from the joined layer should be cached in memory to speed up lookups
Returns name of the field of our layer that will be used for join
- extractJoinedFeature(self, feature: QgsFeature) QgsFeature ¶
Extract the join feature from the target feature for the current join layer information.
- Parameters
feature (QgsFeature) – A feature from the target layer
- Return type
- Returns
the corresponding joined feature
New in version 3.0.
- hasCascadedDelete(self) bool ¶
Returns whether a feature deleted on the target layer has to impact the joined layer by deleting the corresponding joined feature.
New in version 3.0.
- Return type
bool
- hasSubset(self, blocklisted: bool = True) bool ¶
Returns
True
if blocklisted fields is not empty or if a subset of names has been set.New in version 3.0.
- Parameters
blocklisted (bool = True) –
- Return type
bool
- hasUpsertOnEdit(self) bool ¶
Returns whether a feature created on the target layer has to impact the joined layer by creating a new feature if necessary.
New in version 3.0.
- Return type
bool
- isDynamicFormEnabled(self) bool ¶
Returns whether the form has to be dynamically updated with joined fields when a feature is being created in the target layer.
New in version 3.0.
- Return type
bool
- isEditable(self) bool ¶
Returns whether joined fields may be edited through the form of the target layer.
New in version 3.0.
- Return type
bool
- isUsingMemoryCache(self) bool ¶
Returns whether values from the joined layer should be cached in memory to speed up lookups. Will return
False
if upsertOnEdit is enabled.- Return type
bool
- joinFieldName(self) str ¶
Returns name of the field of joined layer that will be used for join
- Return type
str
- joinFieldNamesBlackList(self) List[str] ¶
Returns the list of fields to ignore.
Deprecated since version use:
joinFieldNamesBlockList()
instead- Return type
List[str]
- joinFieldNamesBlockList(self) List[str] ¶
Returns the list of fields to ignore.
See also
New in version 3.14.
- Return type
List[str]
- joinFieldNamesSubset(info: QgsVectorLayerJoinInfo, blocklisted: bool = True) List[str] ¶
Returns the list of field names to use for joining considering blocklisted fields and subset.
New in version 3.0.
joinFieldNamesSubset(self) -> List[str] Returns the subset of fields to be used from joined layer.
All fields will be used if
None
is returned.See also
New in version 2.6.
- Parameters
info (QgsVectorLayerJoinInfo) –
blocklisted (bool = True) –
- Return type
List[str]
- joinLayer(self) QgsVectorLayer ¶
Returns joined layer (may be
None
if the reference was set by layer ID and not resolved yet)- Return type
- joinLayerId(self) str ¶
ID of the joined layer - may be used to resolve reference to the joined layer
- Return type
str
- prefix(self) str ¶
Returns prefix of fields from the joined layer. If
None
, joined layer’s name will be used.- Return type
str
- prefixedFieldName(self, field: QgsField) str ¶
Returns the prefixed name of the field.
- Parameters
field (QgsField) – the field
- Return type
str
- Returns
the prefixed name of the field
New in version 3.0.
- setCascadedDelete(self, enabled: bool)¶
Sets whether a feature deleted on the target layer has to impact the joined layer by deleting the corresponding joined feature.
New in version 3.0.
- Parameters
enabled (bool) –
- setDynamicFormEnabled(self, enabled: bool)¶
Sets whether the form has to be dynamically updated with joined fields when a feature is being created in the target layer.
New in version 3.0.
- Parameters
enabled (bool) –
- setEditable(self, enabled: bool)¶
Sets whether the form of the target layer allows editing joined fields.
New in version 3.0.
- Parameters
enabled (bool) –
- setJoinFieldName(self, fieldName: str)¶
Sets name of the field of joined layer that will be used for join
- Parameters
fieldName (str) –
- setJoinFieldNamesBlackList(self, blackList: Iterable[str])¶
Sets a list of fields to ignore whatever happens.
Deprecated since version use:
setJoinFieldNamesBlockList()
instead- Parameters
blackList (Iterable[str]) –
- setJoinFieldNamesBlockList(self, list: Iterable[str])¶
Sets a
list
of fields to ignore whatever happens.See also
New in version 3.14.
- Parameters
list (Iterable[str]) –
- setJoinFieldNamesSubset(self, fieldNamesSubset: Iterable[str])¶
Sets the subset of fields to be used from joined layer.
Ownership of
fileNamesSubset
is transferred. AfieldNameSubset
ofNone
indicates that all fields should be used.See also
New in version 2.6.
- Parameters
fieldNamesSubset (Iterable[str]) –
- setJoinLayer(self, layer: QgsVectorLayer)¶
Sets weak reference to the joined layer
- Parameters
layer (QgsVectorLayer) –
- setJoinLayerId(self, layerId: str)¶
Sets ID of the joined layer. It will need to be overwritten by
setJoinLayer()
to a reference to real layer- Parameters
layerId (str) –
- setPrefix(self, prefix: str)¶
Sets prefix of fields from the joined layer. If
None
, joined layer’s name will be used.- Parameters
prefix (str) –
- setTargetFieldName(self, fieldName: str)¶
Sets name of the field of our layer that will be used for join
- Parameters
fieldName (str) –
- setUpsertOnEdit(self, enabled: bool)¶
Sets whether a feature created on the target layer has to impact the joined layer by creating a new feature if necessary.
New in version 3.0.
- Parameters
enabled (bool) –
- setUsingMemoryCache(self, enabled: bool)¶
Sets whether values from the joined layer should be cached in memory to speed up lookups
- Parameters
enabled (bool) –
- targetFieldName(self) str ¶
Returns name of the field of our layer that will be used for join
- Return type
str