Skip to content

Commit

Permalink
Fix error when using _both_ types=true and error_trace=true options
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jul 22, 2022
1 parent c1383ec commit db91b3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/crate/client/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class Client(object):
Crate connection client using CrateDB's HTTP API.
"""

SQL_PATH = '/_sql?types'
SQL_PATH = '/_sql?types=true'
"""Crate URI path for issuing SQL statements."""

retry_interval = 30
Expand Down Expand Up @@ -385,7 +385,7 @@ def __init__(self,

self.path = self.SQL_PATH
if error_trace:
self.path += '?error_trace=true'
self.path += '&error_trace=true'

def close(self):
for server in self.server_pool.values():
Expand Down
5 changes: 3 additions & 2 deletions src/crate/client/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,13 @@ def test_params(self):
client = Client(['127.0.0.1:4200'], error_trace=True)
parsed = urlparse(client.path)
params = parse_qs(parsed.query)
self.assertEqual(params["types?error_trace"], ["true"])
self.assertEqual(params["types"], ["true"])
self.assertEqual(params["error_trace"], ["true"])
client.close()

def test_no_params(self):
client = Client()
self.assertEqual(client.path, "/_sql?types")
self.assertEqual(client.path, "/_sql?types=true")
client.close()


Expand Down

0 comments on commit db91b3d

Please sign in to comment.