0

When I run the following Couchbase query from Python

mystring = 'XEXE%'

from couchbase.n1ql import N1QLQuery
row_iter = cb.n1ql_query(N1QLQuery('SELECT BoardAsString FROM boardwascreated WHERE BoardAsString LIKE $mystring', mystring))

I get the error

Error evaluating filter. - cause: No value for named parameter $mystring.

Does anybody know why this is happening?

1 Answer 1

1

Query variables need to be passed as named parameters in the python SDK.

For instance:

for row in c.n1ql_query(N1QLQuery("SELECT keyspace_id FROM system:indexes WHERE keyspace_id LIKE $test", test='test_val')):
    print row

In your particular case:

param = 'XEXE%'
row_iter = cb.n1ql_query(N1QLQuery('SELECT BoardAsString FROM boardwascreated WHERE BoardAsString LIKE $mystring', mystring=param))

The official python SDK documentation might be helpful.

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

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.