Skip to content

CassandraMaterializedView

Inherits: primeight.CassandraTable

The CassandraMaterializedView manages materialized view interactions.

Import

from primeight import CassandraMaterializedView

Constructor

  • config dict [Required]: Table configuration, as returned by one of the parsers.
  • query_name str [Required]: Query name.
  • keyspace primeight.keyspace.CassandraKeyspace [Required]: Keyspace.
  • cassandra_manager primeight.manager.CassandraManager (Default: None): Cassandra manager.

Attributes

query_name

Type: str

Query name.

Methods

create

Build materialized view CREATE statement(s).

Note

The statement is only executed using the execute methods (e.g CassandraMaterializedView.execute).

Parameters:

  • keyspace str or List[str] (Default: None): Keyspace name(s). If a List[str] is passed it will create multiple statements, one for each name. If set to None, CassandraMaterializedView.keyspace is used instead.
  • gc_grace_seconds int (Default: 86400): Grace period in seconds. Time to wait before garbage collecting tombstones (deletion markers).
  • if_not_exists bool (Default: False): If True adds IF NOT EXISTS option to the statement(s). Attempting to create an already existing materialized view will return an error unless the IF NOT EXISTS option is used. If it is used, the statement will be a no-op if the materialized view already exists.

Return: self

drop

Build materialized view DROP statement(s).

Note

The statement is only executed using the execute methods (e.g CassandraMaterializedView.execute).

Parameters:

  • keyspace str or List[str] (Default: None): Keyspace name(s). If a List[str] is passed it will create multiple statements, one for each name. If set to None, CassandraMaterializedView.keyspace is used instead.
  • if_exists bool (Default: False): If True adds IF EXISTS option to the statement(s). If the materialized view(s) do not exist, the statement will return an error, unless IF EXISTS is used in which case the operation is a no-op.

Return: self

insert

Materialize views do not support inserts.

Danger

Calling this method will generate an Exception.

query

Build materialized view SELECT statement(s).

This method can be chained with the methods required to define restrictions, and ending with the CassandraMaterializedView.execute method.

Note

The statement is only executed using the execute methods (e.g CassandraMaterializedView.execute).

Parameters:

  • keyspace str or List[str] (Default: None): Keyspace name(s). If a List[str] is passed it will create multiple statements, one for each name. If set to None, CassandraMaterializedView.keyspace is used instead.

Return: self