Skip to content

Commit 4dccee4

Browse files
SELECT lists of single variables
Closes #56
1 parent a028645 commit 4dccee4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

mcbackend/backends/clickhouse.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ def _get_row_at(
200200
) -> Dict[str, numpy.ndarray]:
201201
self._commit()
202202
names = ",".join(var_names)
203-
data = self._client.execute(f"SELECT ({names}) FROM {self.cid} WHERE _draw_idx={idx};")
203+
# NOTE: The trailing , 👇 is included to get the same signature when len(var_names) == 1.
204+
query = f"SELECT ({names},) FROM {self.cid} WHERE _draw_idx={idx};"
205+
data = self._client.execute(query)
204206
if not data:
205207
raise Exception(f"No record found for draw index {idx}.")
206208
result = dict(zip(var_names, data[0][0]))

mcbackend/test_backend_clickhouse.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ def test_insert_draw(self):
255255
numpy.testing.assert_array_equal(v3, draw["v3"])
256256
pass
257257

258-
@pytest.mark.xfail(reason="issue #56")
259258
def test_get_row_at(self):
260259
run, chains = fully_initialized(
261260
self.backend,

0 commit comments

Comments
 (0)