I'm trying to retrieve the max value of a column in my aws keyspace table using python. I have it as a method in a class
query = SimpleStatement('select min (timestamp) from ' + keyspace + '.'+ table_name) #+ ' limit 2'
read = self.session.execute(query)
return read.current_rows
That is my read function, and I call it :
access.read_latest_timestamp('gdapp_finance','policy_test')
.
I get the below error. Can someone assist me please.
InvalidRequest Traceback (most recent call last)
/tmp/ipykernel_223/2808458841.py in <module>
----> 1 access.read_latest_timestamp('gdapp_finance','policy_test')
/tmp/ipykernel_223/1193162473.py in read_latest_timestamp(self, keyspace, table_name)
58 query = SimpleStatement('select min (timestamp) from ' + keyspace + '.'+ table_name , \
59 consistency_level=ConsistencyLevel.ONE) #+ ' limit 2'
---> 60 read = self.session.execute(query)
61
62 return read.current_rows
~/.local/lib/python3.9/site-packages/cassandra/cluster.cpython-39-x86_64-linux-gnu.so in cassandra.cluster.Session.execute()
~/.local/lib/python3.9/site-packages/cassandra/cluster.cpython-39-x86_64-linux-gnu.so in cassandra.cluster.ResponseFuture.result()
InvalidRequest: Error from server: code=2200 [Invalid query] message="min is not yet supported." ```
AWS Keyspaces only supports a subset of native CQL functions. Functions like MIN()
and MAX()
are not supported.
Similarly, user-defined functions and aggregates are not supported either.
For the list of supported Cassandra functions, see Built-in functions in Amazon Keyspaces.
For the list of supported Cassandra APIs, see Supported Cassandra APIs, operations, and data types in Amazon Keyspaces. Cheers!