首页 > 解决方案 > Python - Cassandra - Assigning a value to a variable from the result set

问题描述

I am trying to assign the result value for a max value query to a variable in python. I have tried getString(), getInt(), getBigInt() functions but ending up with errors like:

AttributeError: 'com.datastax.driver.core.ArrayBackedRow' object has no attribute 'getBigNum'

Here is my function:

def select_max_of_sequece_number():
        query = "select max(text_next_seq_number) as max_seq_num from 
        employee_table;"
        print query
        print ' '
        ResultSet = dbquery(query) #db Query function which will execute the query and returns result
        
        for result in ResultSet:
            row = json.loads(result.getBigNum("max_seq_num"))
            print type(row)

Getting the below error: AttributeError: 'com.datastax.driver.core.ArrayBackedRow' object has no attribute 'getBigNum'

标签: pythoncassandra

解决方案


推荐阅读