Closed
Description
The bug is as follows:
chain.get_draws_at(10, ["slope"])
# produces this π query
ch_client.execute("SELECT (slope) FROM D1K4ZQ_chain_0 WHERE _draw_idx=10;")
# and this π result
[(0.6563459924884462,)]
And this fails with
TypeError Traceback (most recent call last)
c:\Users\osthege\Repos\mcbackend\sandbox.ipynb Zelle 14 in <cell line: 1>()
----> [1](vscode-notebook-cell:/c%3A/Users/osthege/Repos/mcbackend/sandbox.ipynb#X25sZmlsZQ%3D%3D?line=0) chain.get_draws_at(10, ["slope"])
File c:\Users\osthege\Repos\mcbackend\mcbackend\backends\clickhouse.py:257, in ClickHouseChain.get_draws_at(self, idx, var_names)
256 def get_draws_at(self, idx: int, var_names: Sequence[str]) -> Dict[str, numpy.ndarray]:
--> 257 return self._get_row_at(idx, var_names)
File c:\Users\osthege\Repos\mcbackend\mcbackend\backends\clickhouse.py:208, in ClickHouseChain._get_row_at(self, idx, var_names)
206 if not data:
207 raise Exception(f"No record found for draw index {idx}.")
--> 208 result = dict(zip(var_names, data[0][0]))
209 return result
TypeError: 'float' object is not iterable
For comparison, this works:
chain.get_draws_at(10, ["slope", "intercept"])
# produces this π query
ch_client.execute("SELECT (slope,intercept) FROM D1K4ZQ_chain_0 WHERE _draw_idx=10;")
# and this π result
[((0.6563459924884462, 1.2657397542541722),)]
Note the additional braces!