PySide6.QtSql.QSqlRelation¶
- class QSqlRelation¶
The
QSqlRelationclass stores information about an SQL foreign key.Details
QSqlRelationis a helper class forQSqlRelationalTableModel. SeesetRelation()andrelation()for details.See also
QSqlRelationalTableModelQSqlRelationalDelegateRelational Table Model ExampleSynopsis¶
Methods¶
def
__init__()def
displayColumn()def
indexColumn()def
isValid()def
swap()def
tableName()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
- __init__()¶
Constructs an invalid
QSqlRelationobject.For such an object, the
tableName(),indexColumn(), anddisplayColumn()functions return an empty string.See also
- __init__(aTableName, indexCol, displayCol)
- Parameters:
aTableName – str
indexCol – str
displayCol – str
Constructs a
QSqlRelationobject, wheretableNameis the SQL table name to which a foreign key refers,indexColumnis the foreign key, anddisplayColumnis the field that should be presented to the user.See also
- displayColumn()¶
- Return type:
str
Returns the column from table
tableName()that should be presented to the user instead of a foreign key.- indexColumn()¶
- Return type:
str
Returns the index column from table
tableName()to which a foreign key refers.- isValid()¶
- Return type:
bool
Returns
trueif theQSqlRelationobject is valid; otherwise returnsfalse.- swap(other)¶
- Parameters:
other –
QSqlRelation
Swaps this relation with
other. This operation is very fast and never fails.- tableName()¶
- Return type:
str
Returns the name of the table to which a foreign key refers.