本文介紹 django.db.models.UniqueConstraint.include
的用法。
聲明
UniqueConstraint.include
Django 3.2 中的新函數。
要作為非鍵列包含在覆蓋唯一索引中的字段名稱的列表或元組。這允許 index-only 掃描用於僅選擇包含字段 (
) 並僅按唯一字段 (include
) 過濾的查詢。fields
例如:
UniqueConstraint(name='unique_booking', fields=['room', 'date'], include=['full_name'])
將允許過濾 room
和 date
,同時選擇 full_name
,同時僅從索引中獲取數據。
include
僅在 PostgreSQL 上受支持。
非鍵列與
具有相同的數據庫限製。Index.include
相關用法
- Python Django UniqueConstraint.deferrable用法及代碼示例
- Python Django UniqueConstraint.condition用法及代碼示例
- Python Django UniqueConstraint.expressions用法及代碼示例
- Python Django UniqueConstraint.opclasses用法及代碼示例
- Python Django Union用法及代碼示例
- Python Unicode轉ASCII用法及代碼示例
- Python Union()用法及代碼示例
- Python PIL UnsahrpMask()用法及代碼示例
- Python Django UUIDField用法及代碼示例
- Python MongoDB Update_one()用法及代碼示例
- Python Django USERNAME_FIELD用法及代碼示例
- Python Django UserPassesTestMixin.test_func用法及代碼示例
- Python Tableau UserItem用法及代碼示例
- Python Django Upper用法及代碼示例
- Python Django UpdateView.object用法及代碼示例
- Python cudf.core.column.string.StringMethods.is_vowel用法及代碼示例
- Python torch.distributed.rpc.rpc_async用法及代碼示例
- Python torch.nn.InstanceNorm3d用法及代碼示例
- Python sklearn.cluster.MiniBatchKMeans用法及代碼示例
- Python pandas.arrays.IntervalArray.is_empty用法及代碼示例
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代碼示例
- Python numpy.less()用法及代碼示例
- Python Matplotlib.figure.Figure.add_gridspec()用法及代碼示例
- Python tf.compat.v1.distribute.MirroredStrategy.experimental_distribute_dataset用法及代碼示例
- Python Django File.save用法及代碼示例
注:本文由純淨天空篩選整理自djangoproject.com大神的英文原創作品 django.db.models.UniqueConstraint.include。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。