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

extractJoinedFeature

Extract the join feature from the target feature for the current join layer information.

hasCascadedDelete

Returns whether a feature deleted on the target layer has to impact the joined layer by deleting the corresponding joined feature.

hasSubset

Returns True if blocklisted fields is not empty or if a subset of names has been set.

hasUpsertOnEdit

Returns whether a feature created on the target layer has to impact the joined layer by creating a new feature if necessary.

isDynamicFormEnabled

Returns whether the form has to be dynamically updated with joined fields when a feature is being created in the target layer.

isEditable

Returns whether joined fields may be edited through the form of the target layer.

isUsingMemoryCache

Returns whether values from the joined layer should be cached in memory to speed up lookups.

joinFieldName

Returns name of the field of joined layer that will be used for join

joinFieldNamesBlackList

Returns the list of fields to ignore.

joinFieldNamesBlockList

Returns the list of fields to ignore.

joinFieldNamesSubset

Returns the list of field names to use for joining considering blocklisted fields and subset.

joinLayer

Returns joined layer (may be None if the reference was set by layer ID and not resolved yet)

joinLayerId

ID of the joined layer - may be used to resolve reference to the joined layer

prefix

Returns prefix of fields from the joined layer.

prefixedFieldName

Returns the prefixed name of the field.

setCascadedDelete

Sets whether a feature deleted on the target layer has to impact the joined layer by deleting the corresponding joined feature.

setDynamicFormEnabled

Sets whether the form has to be dynamically updated with joined fields when a feature is being created in the target layer.

setEditable

Sets whether the form of the target layer allows editing joined fields.

setJoinFieldName

Sets name of the field of joined layer that will be used for join

setJoinFieldNamesBlackList

Sets a list of fields to ignore whatever happens.

setJoinFieldNamesBlockList

Sets a list of fields to ignore whatever happens.

setJoinFieldNamesSubset

Sets the subset of fields to be used from joined layer.

setJoinLayer

Sets weak reference to the joined layer

setJoinLayerId

Sets ID of the joined layer.

setPrefix

Sets prefix of fields from the joined layer.

setTargetFieldName

Sets name of the field of our layer that will be used for join

setUpsertOnEdit

Sets whether a feature created on the target layer has to impact the joined layer by creating a new feature if necessary.

setUsingMemoryCache

Sets whether values from the joined layer should be cached in memory to speed up lookups

targetFieldName

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:

QgsFeature

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.

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.

Warning

This method is NOT thread safe, and MUST be called from the thread where the vector layers participating in the join reside. See variant which accepts a QgsFields argument for a thread safe alternative.

New in version 3.0.

joinFieldNamesSubset(info: QgsVectorLayerJoinInfo, joinLayerFields: QgsFields, blocklisted: bool = True) -> List[str] Returns the list of field names to use for joining considering blocklisted fields and subset.

This method is thread safe.

New in version 3.30.

joinFieldNamesSubset(self) -> List[str] Returns the subset of fields to be used from joined layer.

All fields will be used if None is returned.

New in version 2.6.

Parameters:
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:

QgsVectorLayer

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.

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. A fieldNameSubset of None indicates that all fields should be used.

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