Comments (6)
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.
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.
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.
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.
It somewhat overlapping with #5 - Following this issue more in what @fpoolev intented
from spring-data-dynamodb.
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)
- Missing Local index projection settings
- Getting classnotfoundexception for class ReflectionEntityInformation HOT 3
- Getting NPE HOT 2
- project init error HOT 1
- Problem with findBy..Contains on a set HOT 3
- GSI query problem. HOT 1
- Hashmap Iteration Problem in thymeleaf
- AbstractDynamoDBEventListener throws assertion error
- using dynamic dynamodb's tablename, don't use find method for GSI. HOT 1
- This Spring Data DynamoDB implementation might not be compatible with the available Spring Data classes on the classpath HOT 5
- cdi-api dependency has a known vulnerability CVE-2014-8122
- TableNameResolver does not work with @DynamoDBIndexHashKey HOT 3
- IN operator and Order By falls back to Scan HOT 1
- @DynamoDBAutoGeneratedTimestamp(strategy=DynamoDBAutoGenerateStrategy.ALWAYS) is not working inside DynamoDBDocument
- Pagination not working properly returning random data.
- spring-data-dynamodb - Spring4Shell: Zero-Day Vulnerability in Spring Framework (CVE-2022-22965) HOT 2
- When 'findBy' method is annotated with @EnableScan or on class level, and the method uses only hash key (and range key), the method still executes scan instead of query. There is only a check if the used fields are GSI, but no checks if all the fields are hash/range keys. HOT 2
- How can I have dynamodb table name dynamically based on my env? HOT 1
- Same hash for multiple GSI, how to fetch data?
- AWS STS(security token service) support for DynamoDBMapper
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-dynamodb.