'assandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid INTEGER constant (42607589003) for Identifier of type text"

I am trying to run a simple query on cassandra host via python.

>>session.execute('SELECT * from "users" WHERE "userid"=42607589003')

But i get error below,"userid" is of type text, i tried different permutations by enclosing in double quotes too, but cannot figure out why this error is thrown

>>cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="Invalid INTEGER constant (42607589003) for Identifier of type text"

can somebody let me know whats wrong here?



Solution 1:[1]

42,607,589,003 isn't representable as a 32 bit integer. Have you tried it without quotes?

Solution 2:[2]

Propably you set your variable in cassandra "userid" as text and you trying to send int 42607589003.

Change this: session.execute('SELECT * from "users" WHERE "userid"=42607589003') To this: session.execute("SELECT * from users WHERE userid='42607589003'")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chris Lohfink
Solution 2 ScooredMars