Scans and Queries can be filtered within Dynamo, preventing the memory, network and marshalling overhead of filtering on the client.

Note that these filters do not reduce the consumed capacity in Dynamo. Even though a filter may lead to a small number of results being returned, it could still exhaust the provisioned capacity or force the provisioned capacity to autoscale up to an expensive level.

import org.scanamo._
import org.scanamo.syntax._
val client = LocalDynamoDB.client()

case class Station(line: String, name: String, zone: Int)
val stationTable = Table[Station]("Station")
LocalDynamoDB.withTable(client)("Station")('line -> S, 'name -> S) {
  val ops = for {
    _ <- stationTable.putAll(Set(
      Station("Metropolitan", "Chalfont & Latimer", 8),
      Station("Metropolitan", "Chorleywood", 7),
      Station("Metropolitan", "Rickmansworth", 7),
      Station("Metropolitan", "Croxley", 7),
      Station("Jubilee", "Canons Park", 5)
    filteredStations <- 
        .filter('zone < 8)
        .query('line -> "Metropolitan" and ('name beginsWith "C"))
  } yield filteredStations
// res0: List[Either[org.scanamo.error.DynamoReadError,Station]] = List(Right(Station(Metropolitan,Chorleywood,7)), Right(Station(Metropolitan,Croxley,7)))

More examples can be found in the Table ScalaDoc.