Allow query parameters to be passed with query#184
Conversation
| description: Query to run, given as a SQL string. | ||
| params: | ||
| type: object | ||
| description: > |
There was a problem hiding this comment.
Can you include an example that shows how this helps avoid the escaping issue
There was a problem hiding this comment.
Yes, absolutely, but I would like to merge HumanCellAtlas/dcp-cli#359 first, and make a complete suite of documentation including the use of this.
| self.assertEqual(response.json['query'], query) | ||
| self.assertGreaterEqual(response.json['results'][0]['count'], 0) | ||
|
|
||
| query = "SELECT count(*) FROM FILES WHERE SIZE > :s;" |
There was a problem hiding this comment.
would it be worth it to add a test showing this gives the same result as running the query without params
"SELECT count(*) FROM FILES WHERE SIZE > 0;"
Also would it be worth it to return the query that was actually run with the params in place to help debug issues?
There was a problem hiding this comment.
-
Yes, but if the database undergoes a change in the number of files as we run the test, the result will change. So we need some way to ensure atomicity in the test. I tried passing multiple queries (
select count(*) from files; select count(*) from files where size > 0;but the first result gets shadowed by the second. Do you know how to ensure atomicity? -
Yes, that's a great idea but I'd like to tackle it separately. Filed Return formatted query in addition to input query with results #186 to track that.
There was a problem hiding this comment.
Maybe if you reset the db connection between queries?
4e85431 to
da1e7d0
Compare
No description provided.