1

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?

4
  • 1
    Why do you need quotes around users and userid? did you try this? "SELECT * FROM users WHERE userid='abc'" Commented Sep 14, 2017 at 21:46
  • without quotes would give me this error: cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="unconfigured columnfamily users" Commented Sep 14, 2017 at 21:51
  • 1
    can you share your table schema? Commented Sep 14, 2017 at 22:02
  • i doubt i can give the whole schema. but the userid is of 'text' Commented Sep 14, 2017 at 22:19

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

1

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'")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.