Skip to content

Projections

Projections Mixin.

Projections

Bases: ClientBase

Handles Projections Operations.

Source code in src/eventstore_grpc/client/projections.py
class Projections(ClientBase):
    """Handles Projections Operations."""

    def create_continuous_projection(
        self, name: str, query: str, track_emitted_streams: bool = False, **kwargs
    ) -> projections_pb2.CreateResp:
        """Creates a continuous projection."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.create_continuous_projection(
            stub,
            name=name,
            query=query,
            track_emitted_streams=track_emitted_streams,
            **kwargs
        )
        return result

    def create_one_time_projection(
        self, query: str, track_emitted_streams: bool = False, **kwargs
    ) -> projections_pb2.CreateResp:
        """Creates a one time projection."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.create_one_time_projection(
            stub, query=query, track_emitted_streams=track_emitted_streams, **kwargs
        )
        return result

    def create_transient_projection(
        self, name: str, query: str, **kwargs
    ) -> projections_pb2.CreateResp:
        """Creates a transient projection."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.create_transient_projection(
            stub, name=name, query=query, **kwargs
        )
        return result

    def delete_projection(
        self,
        name: str,
        delete_emitted_streams: bool = True,
        delete_state_stream: bool = True,
        delete_checkpoint_stream: bool = True,
        **kwargs
    ) -> projections_pb2.DeleteResp:
        """Deletes a projection."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.delete_projection(
            stub,
            name=name,
            delete_emitted_streams=delete_emitted_streams,
            delete_state_stream=delete_state_stream,
            delete_checkpoint_stream=delete_checkpoint_stream,
            **kwargs
        )
        return result

    def disable_projection(
        self, name: str, write_checkpoint: bool = True, **kwargs
    ) -> projections_pb2.DisableResp:
        """Disables a projection."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.disable_projection(
            stub, name=name, write_checkpoint=write_checkpoint, **kwargs
        )
        return result

    def enable_projection(self, name: str, **kwargs) -> projections_pb2.EnableResp:
        """Enables a projection."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.enable_projection(stub, name=name, **kwargs)
        return result

    def list_continuous_projections(
        self, **kwargs
    ) -> Iterable[projections_pb2.StatisticsResp]:
        """Lists continuous projections."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.list_continuous_projections(stub, **kwargs)
        return result

    def list_one_time_projections(
        self, **kwargs
    ) -> Iterable[projections_pb2.StatisticsResp]:
        """Lists one time projections."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.list_one_time_projections(stub, **kwargs)
        return result

    def list_transient_projections(
        self, **kwargs
    ) -> Iterable[projections_pb2.StatisticsResp]:
        """List transient projections."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.list_transient_projections(stub, **kwargs)
        return result

    def reset_projection(
        self, name: str, write_checkpoint: bool = True, **kwargs
    ) -> projections_pb2.ResetResp:
        """Resets a projection."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.reset_projection(
            stub, name=name, write_checkpoint=write_checkpoint, **kwargs
        )
        return result

    def restart_projections_subsystem(self, **kwargs) -> shared_pb2.Empty:
        """Restarts projections subsystem."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.restart_projections_subsystem(stub, **kwargs)
        return result

    def get_projection_result(
        self, name: str, from_partition: Optional[str] = None, **kwargs
    ) -> projections_pb2.ResultResp:
        """Gets a projection result."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.get_projection_result(
            stub, name=name, from_partition=from_partition, **kwargs
        )
        return result

    def get_projection_state(self, name: str, **kwargs) -> projections_pb2.StateResp:
        """Gets a projection's state."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.get_projection_state(stub, name=name, **kwargs)
        return result

    def get_projection_statistics(
        self, name: str, **kwargs
    ) -> Iterable[projections_pb2.StatisticsResp]:
        """Gets projection statistics."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.get_projection_statistics(stub, name=name, **kwargs)
        return result

    def update_projection(
        self,
        name: str,
        query: str,
        track_emitted_streams: Optional[bool] = None,
        **kwargs
    ) -> projections_pb2.UpdateResp:
        """Updates a projection."""
        stub = projections_pb2_grpc.ProjectionsStub(self.channel)
        result = projections.update_projection(
            stub,
            name=name,
            query=query,
            track_emitted_streams=track_emitted_streams,
            **kwargs
        )
        return result

create_continuous_projection(name, query, track_emitted_streams=False, **kwargs)

Creates a continuous projection.

Source code in src/eventstore_grpc/client/projections.py
def create_continuous_projection(
    self, name: str, query: str, track_emitted_streams: bool = False, **kwargs
) -> projections_pb2.CreateResp:
    """Creates a continuous projection."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.create_continuous_projection(
        stub,
        name=name,
        query=query,
        track_emitted_streams=track_emitted_streams,
        **kwargs
    )
    return result

create_one_time_projection(query, track_emitted_streams=False, **kwargs)

Creates a one time projection.

Source code in src/eventstore_grpc/client/projections.py
def create_one_time_projection(
    self, query: str, track_emitted_streams: bool = False, **kwargs
) -> projections_pb2.CreateResp:
    """Creates a one time projection."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.create_one_time_projection(
        stub, query=query, track_emitted_streams=track_emitted_streams, **kwargs
    )
    return result

create_transient_projection(name, query, **kwargs)

Creates a transient projection.

Source code in src/eventstore_grpc/client/projections.py
def create_transient_projection(
    self, name: str, query: str, **kwargs
) -> projections_pb2.CreateResp:
    """Creates a transient projection."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.create_transient_projection(
        stub, name=name, query=query, **kwargs
    )
    return result

delete_projection(name, delete_emitted_streams=True, delete_state_stream=True, delete_checkpoint_stream=True, **kwargs)

Deletes a projection.

Source code in src/eventstore_grpc/client/projections.py
def delete_projection(
    self,
    name: str,
    delete_emitted_streams: bool = True,
    delete_state_stream: bool = True,
    delete_checkpoint_stream: bool = True,
    **kwargs
) -> projections_pb2.DeleteResp:
    """Deletes a projection."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.delete_projection(
        stub,
        name=name,
        delete_emitted_streams=delete_emitted_streams,
        delete_state_stream=delete_state_stream,
        delete_checkpoint_stream=delete_checkpoint_stream,
        **kwargs
    )
    return result

disable_projection(name, write_checkpoint=True, **kwargs)

Disables a projection.

Source code in src/eventstore_grpc/client/projections.py
def disable_projection(
    self, name: str, write_checkpoint: bool = True, **kwargs
) -> projections_pb2.DisableResp:
    """Disables a projection."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.disable_projection(
        stub, name=name, write_checkpoint=write_checkpoint, **kwargs
    )
    return result

enable_projection(name, **kwargs)

Enables a projection.

Source code in src/eventstore_grpc/client/projections.py
def enable_projection(self, name: str, **kwargs) -> projections_pb2.EnableResp:
    """Enables a projection."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.enable_projection(stub, name=name, **kwargs)
    return result

get_projection_result(name, from_partition=None, **kwargs)

Gets a projection result.

Source code in src/eventstore_grpc/client/projections.py
def get_projection_result(
    self, name: str, from_partition: Optional[str] = None, **kwargs
) -> projections_pb2.ResultResp:
    """Gets a projection result."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.get_projection_result(
        stub, name=name, from_partition=from_partition, **kwargs
    )
    return result

get_projection_state(name, **kwargs)

Gets a projection's state.

Source code in src/eventstore_grpc/client/projections.py
def get_projection_state(self, name: str, **kwargs) -> projections_pb2.StateResp:
    """Gets a projection's state."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.get_projection_state(stub, name=name, **kwargs)
    return result

get_projection_statistics(name, **kwargs)

Gets projection statistics.

Source code in src/eventstore_grpc/client/projections.py
def get_projection_statistics(
    self, name: str, **kwargs
) -> Iterable[projections_pb2.StatisticsResp]:
    """Gets projection statistics."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.get_projection_statistics(stub, name=name, **kwargs)
    return result

list_continuous_projections(**kwargs)

Lists continuous projections.

Source code in src/eventstore_grpc/client/projections.py
def list_continuous_projections(
    self, **kwargs
) -> Iterable[projections_pb2.StatisticsResp]:
    """Lists continuous projections."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.list_continuous_projections(stub, **kwargs)
    return result

list_one_time_projections(**kwargs)

Lists one time projections.

Source code in src/eventstore_grpc/client/projections.py
def list_one_time_projections(
    self, **kwargs
) -> Iterable[projections_pb2.StatisticsResp]:
    """Lists one time projections."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.list_one_time_projections(stub, **kwargs)
    return result

list_transient_projections(**kwargs)

List transient projections.

Source code in src/eventstore_grpc/client/projections.py
def list_transient_projections(
    self, **kwargs
) -> Iterable[projections_pb2.StatisticsResp]:
    """List transient projections."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.list_transient_projections(stub, **kwargs)
    return result

reset_projection(name, write_checkpoint=True, **kwargs)

Resets a projection.

Source code in src/eventstore_grpc/client/projections.py
def reset_projection(
    self, name: str, write_checkpoint: bool = True, **kwargs
) -> projections_pb2.ResetResp:
    """Resets a projection."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.reset_projection(
        stub, name=name, write_checkpoint=write_checkpoint, **kwargs
    )
    return result

restart_projections_subsystem(**kwargs)

Restarts projections subsystem.

Source code in src/eventstore_grpc/client/projections.py
def restart_projections_subsystem(self, **kwargs) -> shared_pb2.Empty:
    """Restarts projections subsystem."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.restart_projections_subsystem(stub, **kwargs)
    return result

update_projection(name, query, track_emitted_streams=None, **kwargs)

Updates a projection.

Source code in src/eventstore_grpc/client/projections.py
def update_projection(
    self,
    name: str,
    query: str,
    track_emitted_streams: Optional[bool] = None,
    **kwargs
) -> projections_pb2.UpdateResp:
    """Updates a projection."""
    stub = projections_pb2_grpc.ProjectionsStub(self.channel)
    result = projections.update_projection(
        stub,
        name=name,
        query=query,
        track_emitted_streams=track_emitted_streams,
        **kwargs
    )
    return result