cqle: update docs for new __options__ model attribute
This commit is contained in:
@@ -20,8 +20,8 @@ Model
|
||||
person.first_name #returns 'Blake'
|
||||
person.last_name #returns 'Eggleston'
|
||||
|
||||
*Model attributes define how the model maps to tables in the database. These are class variables that should be set
|
||||
when defining Model deriviatives.*
|
||||
Model attributes define how the model maps to tables in the database. These are class variables that should be set
|
||||
when defining Model deriviatives.
|
||||
|
||||
.. autoattribute:: __abstract__
|
||||
:annotation: = False
|
||||
@@ -39,97 +39,49 @@ Model
|
||||
|
||||
See :ref:`model_inheritance` for usage examples.
|
||||
|
||||
*Each table can have its own set of configuration options.
|
||||
These can be specified on a model with the following attributes:*
|
||||
Each table can have its own set of configuration options, including compaction. Unspecified, these default to sensible values in
|
||||
the server. To override defaults, set options using the model ``__options__`` attribute, which allows options specified a dict.
|
||||
|
||||
When a table is synced, it will be altered to match the options set on your table.
|
||||
This means that if you are changing settings manually they will be changed back on resync.
|
||||
|
||||
Do not use the options settings of cqlengine if you want to manage your compaction settings manually.
|
||||
|
||||
See the `list of supported table properties for more information
|
||||
<http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/tabProp.html>`_.
|
||||
|
||||
.. attribute:: __bloom_filter_fp_chance
|
||||
|
||||
.. attribute:: __caching__
|
||||
|
||||
.. attribute:: __comment__
|
||||
|
||||
.. attribute:: __dclocal_read_repair_chance__
|
||||
|
||||
.. attribute:: __default_time_to_live__
|
||||
|
||||
.. attribute:: __gc_grace_seconds__
|
||||
|
||||
.. attribute:: __index_interval__
|
||||
|
||||
.. attribute:: __memtable_flush_period_in_ms__
|
||||
|
||||
.. attribute:: __populate_io_cache_on_flush__
|
||||
|
||||
.. attribute:: __read_repair_chance__
|
||||
|
||||
.. attribute:: __replicate_on_write__
|
||||
|
||||
|
||||
*Model presently supports specifying compaction options via class attributes.
|
||||
cqlengine will only use your compaction options if you have a strategy set.
|
||||
When a table is synced, it will be altered to match the compaction options set on your table.
|
||||
This means that if you are changing settings manually they will be changed back on resync.*
|
||||
|
||||
*Do not use the compaction settings of cqlengine if you want to manage your compaction settings manually.*
|
||||
|
||||
*cqlengine supports all compaction options as of Cassandra 1.2.8.*
|
||||
|
||||
**These attibutes will likely be replaced by a single options string in a future version, and are therefore deprecated.**
|
||||
|
||||
.. attribute:: __compaction_bucket_high__
|
||||
:annotation: Deprecated
|
||||
|
||||
.. attribute:: __compaction_bucket_low__
|
||||
:annotation: Deprecated
|
||||
|
||||
.. attribute:: __compaction_max_compaction_threshold__
|
||||
:annotation: Deprecated
|
||||
|
||||
.. attribute:: __compaction_min_compaction_threshold__
|
||||
:annotation: Deprecated
|
||||
|
||||
.. attribute:: __compaction_min_sstable_size__
|
||||
:annotation: Deprecated
|
||||
|
||||
.. attribute:: __compaction_sstable_size_in_mb__
|
||||
:annotation: Deprecated
|
||||
|
||||
.. attribute:: __compaction_tombstone_compaction_interval__
|
||||
:annotation: Deprecated
|
||||
|
||||
.. attribute:: __compaction_tombstone_threshold__
|
||||
:annotation: Deprecated
|
||||
.. attribute:: __options__
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class User(Model):
|
||||
__compaction__ = cqlengine.LeveledCompactionStrategy
|
||||
__compaction_sstable_size_in_mb__ = 64
|
||||
__compaction_tombstone_threshold__ = .2
|
||||
__options__ = {'compaction': {'class': 'LeveledCompactionStrategy',
|
||||
'sstable_size_in_mb': '64',
|
||||
'tombstone_threshold': '.2'},
|
||||
'read_repair_chance': '0.5',
|
||||
'comment': 'User data stored here'}
|
||||
|
||||
user_id = columns.UUID(primary_key=True)
|
||||
name = columns.Text()
|
||||
|
||||
or for SizeTieredCompaction:
|
||||
or :
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class TimeData(Model):
|
||||
__compaction__ = SizeTieredCompactionStrategy
|
||||
__compaction_bucket_low__ = .3
|
||||
__compaction_bucket_high__ = 2
|
||||
__compaction_min_threshold__ = 2
|
||||
__compaction_max_threshold__ = 64
|
||||
__compaction_tombstone_compaction_interval__ = 86400
|
||||
__options__ = {'compaction': {'class': 'SizeTieredCompactionStrategy',
|
||||
'bucket_low': '.3',
|
||||
'bucket_high': '2',
|
||||
'min_threshold': '2',
|
||||
'max_threshold': '64',
|
||||
'tombstone_compaction_interval': '86400'},
|
||||
'gc_grace_seconds': '0'}
|
||||
|
||||
Tables may use `LeveledCompactionStrategy` or `SizeTieredCompactionStrategy`. Both options are available in the top level cqlengine module. To reiterate, you will need to set your `__compaction__` option explicitly in order for cqlengine to handle any of your settings.
|
||||
|
||||
*The base methods allow creating, storing, and querying modeled objects.*
|
||||
The base methods allow creating, storing, and querying modeled objects.
|
||||
|
||||
.. automethod:: create
|
||||
|
||||
|
||||
Reference in New Issue
Block a user