0

I'm working in Python in a Jupyter Notebook and using data from a QuestDB instance.

The helper function I've defined to read data:

def query(q):
    r = requests.get(f"http://{ip}:{port}/exp?query="+q)
    rawData = r.text
    df = pd.read_csv(io.StringIO(rawData))
    return df

So using this query on the data:

query("select * from users")

Yields:

enter image description here

But if we then try to query back that data for the specific user_id returned:

query("select * from users where user_id = 72")

What is returned is a No query text error from QuestDB:

enter image description here

I already tried altering the data type, i.e. '72' instead of 72. What is weird is that I have other much more complex queries that work on other fields of the same table and return results.

Any help is appreciated!

1 Answer 1

2

My guess is that when you add the where user_id = 72 part to the query the second = sign messes the HTTP request up and QuestDB does not receive the query param at all. Hence the No query text error.

I suggest you try to encode the URL before passing it to requests.get(). It would look something like this:

def query(q):
    r = requests.get(f"http://{ip}:{port}/exp?query="+requests.utils.quote(q))
    rawData = r.text
    df = pd.read_csv(io.StringIO(rawData))
    return df
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.