1
votes

I'm trying to insert a Python dictionary and I got the code=2200 [Invalid query] message="Key may not be empty" error when I was writing to cassandra DB. Do anyone have an idea what's going on?

Casandra writer:

def writer(**kwargs):
    try:
        openEventStream.create(
            venue_name = get_dict_val(kwargs, 'venue_name'),
            venue_lon = get_dict_val(kwargs, 'venue_lon'),
            ....
        )
    except Exception, e:
        print e

Actually write into cassandra:

def fetch_data(messages):
    for message in messages:
        # venue
        venue = get_dict_val(message, 'venue')
        if venue:
            venue_name = get_dict_val(venue, 'venue_name')
            venue_lon = get_dict_val(venue, 'venue_lon')
            ...
        else:
            venue_name, venue_lon = None, None                

        writer(venue_name = venue_name, venue_lon = venue_lon)

then execute:

fetch_data(some_nested_dict)
1
Can you share some code? - Gergely Bacso
Seems like you are trying to insert null into a column that shouldn't be null - TheGeorgeous
Thanks Gergely! I added some code - user3368526
Hi TheGeorgeous, thanks :) I see. But what would cause it to happen? For example, I only have primary key and don't have any other requirements for columns. - user3368526

1 Answers

1
votes

It looks like either you are not inserting data in your all the partition key or in all the clustering column.