Comments (7)
Can you please be more specific? Where are you attempting to set using options for an insert statement?
from spring-data-cassandra.
I want to set timestamp in below code:
WriteOptions options = new WriteOptions();
options.setTtl(60);
options.setConsistencyLevel(ConsistencyLevel.ONE);
options.setRetryPolicy(RetryPolicy.DOWNGRADING_CONSISTENCY);
then use the execute(cql, queryWriteOptions); which accepts WriteOptions/QueryOptions as parameter.
from spring-data-cassandra.
I see TTL here;
But the insert syntax accepts TIMESTAMP as below:
::= INSERT INTO
'(' ( ',' )* ')'
VALUES '(' ( ',' )* ')'
( IF NOT EXISTS )?
( USING ( AND )* )?
::=
|
from spring-data-cassandra.
Here is the link to the syntax:
https://cassandra.apache.org/doc/cql3/CQL.html#selectStmt
from spring-data-cassandra.
Ah, I see. You've caught us midstream on a change where we're deprecating the method execute(String,QueryOptions)
. I haven't merged the code back in to master from branch DATACASS-145, but the problem is that there is a limitation in the underlying C* Java driver. We have no way of knowing what kind of statement is being given in the string, so we must use the driver's SimpleStatement
class; see the code here. Unfortunately, SimpleStatement
, which indirectly extends Statement
, does not support setting the TTL. The new deprecation warning, if you want to see it, is here.
If you want to set TTL for an INSERT
or UPDATE
statement, you must either embed the USING
clause into the given CQL string that you pass to execute(String,QueryOptions)
, or use one of either execute(Insert)
or execute(Update)
and use Insert
or Update
's support for TTL. If there were a way to construct an Insert
or Update
object via an arbitrary string, we might be able to once again support the method (albeit in another form), but the driver gives us no such capability.
I'm closing this issue, since we're at the underlying C* Java driver's mercy here. Sorry.
from spring-data-cassandra.
Incidentally, I'm not sure that WriteOptions
ever supported a timestamp
property. I've noted that we should add support for it in https://jira.spring.io/browse/DATACASS-155, though.
from spring-data-cassandra.
Thanks for the input Matthew. Its very helpful. Also thanking you for adding future support with timestamp.
from spring-data-cassandra.
Related Issues (20)
- Release 4.1.8 (2023.0.8)
- Release 4.2.2 (2023.1.2)
- Extend license header copyright years to 2024
- Extend license header copyright years to 2024
- Extend license header copyright years to 2024
- Extend license header copyright years to 2024
- Datastax java-driver maven coordinates have changed HOT 1
- Release 4.1.9 (2023.0.9)
- Release 4.2.3 (2023.1.3)
- Constructor with `@Column`-annotated arguments leads to memory leak
- DTO projections causes the converter to be called twice
- Codec not found for requested operation using a `Set` of mapped User Defined Type HOT 3
- Documentation is out of date HOT 3
- Refine documentation
- Revise `@PrimaryKey` to be an alias for `@Column` HOT 1
- Add support for ValueExpression
- Release 4.1.10 (2023.0.10)
- Release 4.2.4 (2023.1.4)
- Release 4.3 M2 (2024.0.0)
- How do I add converter from Instant to org.joda.time.DateTime to spring-data-commons-3.2.1 and spring-data-cassandra-4.2.1 HOT 8
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-cassandra.