Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    mdulac-photobox
    @mdulac-photobox
    Hello there !
    I've tried for hours to make a simple query with Scanamo, but I didn't succeed.
    I would live to make a query with a constraint on a column : the value must be in a set.
    I tried something like : usageIndex.query('PhotoId -> ids.map(_.value)) but that returns no result at all.
    There's an implicit method creating a ConditionExpression[(AttributeName, Set[V])], so I'm running this way...
    If you have time to help me, I really appreciate ! Thank you
    Regis Kuckaertz
    @regiskuckaertz
    hi @mdulac-photobox ! is PhotoId the partition key?
    mdulac-photobox
    @mdulac-photobox
    Yes, the partition key of the secondary index
    My request works if I write something like usageIndex.query('PhotoId -> "123"), but can't work with a set of values. I tried to build an Or Condition from my ids list, but I failed also
    Regis Kuckaertz
    @regiskuckaertz
    mdulac-photobox
    @mdulac-photobox
    It already is.
    For example : I want to request all the rows for ids "1", "2," and "3". Kind of : id IN ("1", "2", "3"). I wanted to build a condition with scanamo like 'PhotoId -> "1" or 'PhotoId -> "2" or 'PhotoId -> "3". Is this possible ?
    Regis Kuckaertz
    @regiskuckaertz
    ha, sorry I didn;t understand initially. yes it is with Table#filter: usageIndex.filter(‘PhotoIn -> Set(1, 2, 3)).scan() (a condition expression such as x IN xs can only be applied as a filter)
    mdulac-photobox
    @mdulac-photobox
    Ok thank you Regis, I will have a try tomorrow ! So I guess I have no other choice that use the Scan API. I would prefer using Query API for a performance reason.
    mdulac-photobox
    @mdulac-photobox
    The request works, thank you !
    I will make a request to our AWS technical account manager for the performance questioning.
    Thank you Regis.
    Fabio Labella
    @SystemFw
    Hey people, just wondering is there were any plans for a milestone release any time soon? There are a couple of bugs wrt empty maps and empty arrays being serialised as NULL which have bitten us and have been fixed in master already. Thanks for your time :)
    Regis Kuckaertz
    @regiskuckaertz
    I’ll finish work on the *AndReturn APIs then release another milestone, hoping to get this done by end of week.
    Fabio Labella
    @SystemFw
    thanks a lot!
    wrbriggs
    @wrbriggs
    I have a ridiculously basic question about Scanamo - I'm trying to use ScanamoAlpakka in order to get a akka.stream.scaladsl.Source, and the Scaladoc says this is possible, depending on the "kind of execution used" - I can't find any examples in the docs, and am struggling a bit. Has anyone done this, and if so, where can I find the docs on how to do it?
    Drew Boardman
    @drewboardman
    started running into this could not find implicit value for parameter exported: org.scanamo.export.Exported
    i have
    import org.scanamo.semiauto._
    import org.scanamo.syntax._
    i think it's because my type has Instant in it
    eh, removed Instant and it still doesn't like it
    Drew Boardman
    @drewboardman
    does scanamo have an issue with storing ADTs in a table?
    like if i have
    sealed trait Thing
    
    case class Foo(a: Int, b: String) extends Thing
    case class Bar(a: Long, b: String, c: Int) extends Thing
    
    val thingTable: Table[Thing] = Table[Thing]("thing_table")(deriveDynamoFormat[Thing])
    Drew Boardman
    @drewboardman
    @regiskuckaertz
    Drew Boardman
    @drewboardman
    So I'm getting closer to the issue, but it's go to do with ambiguous implicits
    genericProduct | genericCoProduct
    both are in scope
    if I provide one explicitly I see could not find implicit value for parameter gen: shapeless.LabelledGeneric.Aux[T,R]
    here is a reproduction
    vidsPersonalUsername
    @vidsPersonalUsername
    Hello. Is there an example of incrementing/decrementing? I found scanamo/scanamo#114 that claims one could use add in an update, but as far as I can tell, add adds a field, rather than incrementing its value. Am I missing something?
    galosa
    @galosa
    Hey all, I've got a table and a GSI (Global secondary index) which has a primary key of org (S) and sort key of a timestamp (N).
    I'm trying to query without success on this secondary index.
    val query = secondaryIndex .query('org -> org.name and 'timestamp >= startTimeMs) which is fine but
    val query = secondaryIndex .query('org -> org.name and 'timestamp >= startTimeMs and 'timestamp <= endTimeMs) isn't compile.
    I've also tried to use between but that neither succeeded.
    Can you please help here? How do I filter my primary key and also using range query (such as between ) on my sort key in a GSI, note that I can't use filter since I'm using the sort key and dynamo won't allow that
    Alessandro Candolini
    @alessandrocandolini
    Hey all, any plan to add query0 to secondary indexes? i've found an issue and a DRAFT PR for that, but no update after Aug 9th 2019. Are there any blockers or is just a matter of completing the existing draft PR? are contributions welcome in case?
    rabzu
    @rabzu

    Is this group still active? I'm trying to derive DynamoFormat for io.estatico.newtype.

     import io.estatico.newtype.ops._
    
      implicit def coercibleDecoder[A:Coercible[B, *],B]: DynamoFormat[A] =
            DynamoFormat.coercedXmap[A, B, IllegalArgumentException](_.coerce[A])(
              _.repr.asInstanceOf[B]
            )

    But I get

    Error:(107, 78) could not find implicit value for evidence parameter of type org.scanamo.DynamoFormat[B]
            DynamoFormat.coercedXmap[A, B, IllegalArgumentException](_.coerce[A])(

    Can anyone help?

    Aleksey Troitskiy
    @road21
    @rabzu Looks like the group moved to https://gitter.im/scanamo/scanamo
    You need DynamoFormat[B] in context to derive DynamoFormat[A] in this case
    renancaju
    @renancaju
    Hi, there. Any plans for an upgrade to zio RC-18 onwards?
    Barys Ilyushonak
    @biscout24
    Hi there, I hope it is the right place to ask questions about scanamo. I have a table with global secondary index with projection type INCLUDE , so I have only couple of fields in the index in comparison to the table itself. During query I have InvalidPropertiesError . Is that a way to query GSI with projection in scanamo?
    Simon Gaeremynck
    @simong

    Hello, we're intending to use Dynamo to track basic usage statistics for some events. In our current table layout, we'd have a composite key and then a dynamic set of attributes with number values. e.g.

    PK | sortKey | dynamicAttr1 | dynamicAttr2 | ..
    ----
     1 | 2020-05-28 |   7  |  4 | ...
     1 | 2020-05-29 |  12  | null | ...
     2 | 2020-05-29 | null |  3 | ...
    
    ...

    The above is easily done with the add UpdateExpression and generating a Symbol. However, is there an easy way to deserialize the items back out when doing a GET / Scan? Ideally, into something like a Map[String, Long] or Seq[(String, Long)]

    Simon Gaeremynck
    @simong
    AFAICT, DynamoFormat provides a one-column-to-one-item mapping ?
    Keir Lawson
    @keirlawson
    total noob question, how does one construct a UniqueKey for a get op? I've got Symbol("PartitionKey") -> "User#some-id" but my compiler doesn't seem to like that?
    Jean Logeart
    @jlogeart

    Is there an easy way to get a non materialized list for a query?
    Something like

    def iterateAll(query: Query[_]): ScanamoOps[Iterator[Either[DynamoReadError, V]]]

    I would not mind creating my own wrapper using .from and .limit as a paging mechanism, but the lastEvaluatedKey is not accessible and therefore I cannot use it in the next .from

    Use case is a query going through millions of items that I do not want to bring in memory but would like to execute a side effect on
    Jean Logeart
    @jlogeart
    Answered my own question:
    val toLazyList: Id ~> LazyList = new (Id ~> LazyList) {
      def apply[A](fa: Id[A]): LazyList[A] = LazyList(fa)
    }
    val op = si.queryPaginatedM[LazyList](query, pageSize = 10000)
    scanamo.execT(toLazyList)(op).flatten // LazyList[Either[DynamoReadError, V]]
    vivedha
    @vivedha
    Hey all, I have been trying to create a table with more than one GSI but wouldn't. I am able to create a table with a single GSI and query the same though. Couldn't find examples for more than one GSI too. Can someone please point me to some resource/functions on how to do it.Thanks!!
    Nick Schouten
    @NickSchouten_gitlab
    Hi, am I right in assuming that this code still suffers from the same problem depicted here https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.ConditionalUpdate
    Two independent services with this code might both read an item and update the table with their version instead of sequentially doing this operation?
    Creating a lost transaction?
    scanamoClient.exec(table.`given`("amountLeft" >= amountToTake).update(e, add("amountLeft"  -> -amountToTake)))
    Simon Gaeremynck
    @simong
    Not sure if this gitter is dead, but I'd like to ask again. Is there a way to serialize a table with dynamic number attributes into an instance that has member of type Map[String, Long] ?
    Hunor Kovács
    @kovacshuni
    @regiskuckaertz thank you for the latest AWS SDK v2. :tada: That's all I wanted to say.
    No. Other things are: Is someone taking up the fostering of Scanamo? pls
    Sydney Osborne
    @sydneyos
    Does anyone have an up-to-date example of how to do pagination? Seems to have evolved quite a bit and it's not in the docs.
    MeniSametAtCarbnye
    @MeniSametAtCarbnye
    Hi, is it possible to modify the updated return? as i see now there is no capability for that at the system, and it looks likes that is very easy to implement, can i create a PR for that? or i miss something?
    renancaju
    @renancaju
    Hi, everyone. Are there any examples on using queryPaginatedM with ZIO? I'm currently stuck
    Chris Lewis
    @chrislewis
    hi all :wave: - new here and hoping to get a maintainer's eyes on this PR scanamo/scanamo#1324
    3 replies
    Daniel Demidov
    @lpolaright

    hey! I'm trying to figure out how to delete an item from dynamo db using a composite key.

    it appears that doing this:
    .delete(EntityIdKey === entityId and(RangeKey === rangeKey.value))
    (the composite key is comprised from the hash of EntityId, and range key of RangeKey)

    results to Query key condition not supported responses while testing

    I've been looking at documentation but can't really see anything around my use case?

    Daniel Demidov
    @lpolaright

    hrmm... seems like i can't read or update either, I guess my configuration is wrong for the composite key:

    val keys = Seq(
          KeySchemaElement
            .builder()
            .attributeName(EntityIdKey)
            .keyType(KeyType.HASH).build(),
          KeySchemaElement
            .builder()
            .attributeName(RangeKey)
            .keyType(KeyType.RANGE).build(),
        )
    
        val attributes = Seq(
          AttributeDefinition
            .builder()
            .attributeName(EntityIdKey)
            .attributeType(ScalarAttributeType.N)
            .build(),
          AttributeDefinition
            .builder()
            .attributeName(RangeKey)
            .attributeType(ScalarAttributeType.N)
            .build(),
        )
    
        val cfg = DynamoDbSetup.DynamoTableConfig(
          tableName = tableConfig.tableName,
          capacityConfig = DynamoDbSetup.OnDemand,
          ttlConfig = None,
        )
        DynamoDbSetup.createTable(dynamoDbClient, cfg, keys, attributes)

    What am I doing wrong?