Code Monkey home page Code Monkey logo

Comments (6)

mswolfe avatar mswolfe commented on July 16, 2024

From what I can tell spring-data-dynamodb supports both findBy and queryBy in a similar fashion. For either case it will attempt to build a dynamo db QueryRequest first and fall back on a Scan if the properties are not a HashKey/RangeKey or listed as the HashKey/RangeKey of a GSI. For scan to work you need to annotate either the class or method with @EnableScan.

I haven't seen anything in the code base that would support things like "Top" or "First", but there is support for Pageable and Sort. With the caveat that Sort will only work if it is performed on a RangeKey and I thought I saw something about Pageable having some limitations as well.

The AND keyword is supported, but OR queries are not.

As for the property comparisons, I have found this method which appears to provide the following support, written as spring-data keyword mapping to dynamodb condition ComparisonOperator keyword:

  • IN -> Not sure which dynamodb mapping, but appears to check if a property exists in an array/collection.
  • CONTAINING -> CONTAINS
  • STARTING_WITH -> BEGINS_WITH
  • BETWEEN -> BETWEEN
  • AFTER -> GT
  • GREATER_THAN -> GT
  • BEFORE -> LT
  • LESS_THAN -> LT
  • GREATER_THAN_EQUAL -> GE
  • LESS_THAN_EQUAL -> LE
  • IS_NULL -> NULL
  • IS_NOT_NULL -> NOT_NULL
  • TRUE -> EQ
  • FALSE -> EQ
  • SIMPLE_PROPERTY -> EQ, but has special conditions if the property is a HashKey/RangeKey.
  • NEGATING_SIMPLE_PROPERTY -> NE

Lastly, case insensitivity is NOT supported.

Take this with a grain of salt as it just comes from my limited use of the library and poking through the code.

from spring-data-dynamodb.

fpoolev avatar fpoolev commented on July 16, 2024

Awesome! Thank you for clarifying which comparisons and keywords are supported. We should add this list to the README to clarify the subset of supported features. I'll be looking through this project more in the upcoming days and I hope to use it in a new project. So far I have successfully used the AND keyword and the BETWEEN, AFTER, GREATER_THAN, BEFORE, LESS_THAN, GREATER_THAN_EQUAL, LESS_THAN_EQUAL property comparisons using java.util.Date.

from spring-data-dynamodb.

mswolfe avatar mswolfe commented on July 16, 2024

I've created the following page in the wiki with the information that I've detailed above: https://github.com/derjust/spring-data-dynamodb/wiki/Supported-Spring-Data-Comparison-Operators

I don't think the page is 100% complete or accurate, but is it enough to close this issue?

@derjust is this a duplicate of issue 5?

from spring-data-dynamodb.

fpoolev avatar fpoolev commented on July 16, 2024

Yeah, that definitely answered my question however I'd like to keep the issue open a reminder to look into supporting the first and top keywords for limiting queries. I apologize for the combined enhancement request / question post.

from spring-data-dynamodb.

derjust avatar derjust commented on July 16, 2024

It somewhat overlapping with #5 - Following this issue more in what @fpoolev intented

from spring-data-dynamodb.

Neuw84 avatar Neuw84 commented on July 16, 2024

Hi,
I am trying to build a query against a table with a timestamp based sorting. The thing is that if I do findByTimestampBetweenAndDevice the query works ok without using @EnableScan.

However if I use findByTimestampBetweenAndDeviceAndRelaysNotNull it throws and Exception saying that I need to use @EnableScan.

I can do a query like the last one using a Query via the Amazon DynamoDB web panel. I am building the query correctly?

Someone has been sucessful with these kind of operators?

Thanks

from spring-data-dynamodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.