diff --git a/riak/codecs/ttb.py b/riak/codecs/ttb.py index 00def900..5cec7038 100644 --- a/riak/codecs/ttb.py +++ b/riak/codecs/ttb.py @@ -153,6 +153,12 @@ def decode_timeseries(self, resp_ttb, tsobj, self.maybe_err_ttb(resp_ttb) + # NB: some queries return a BARE 'tsqueryresp' atom + # catch that here: + if resp_ttb == tsqueryresp_a: + return tsobj + + # The response atom is the first element in the response tuple resp_a = resp_ttb[0] if resp_a == tsputresp_a: return diff --git a/riak/tests/test_timeseries_ttb.py b/riak/tests/test_timeseries_ttb.py index e1bf96a8..cd7b181c 100644 --- a/riak/tests/test_timeseries_ttb.py +++ b/riak/tests/test_timeseries_ttb.py @@ -130,6 +130,22 @@ class TimeseriesTtbTests(IntegrationTestBase, unittest.TestCase): def setUpClass(cls): super(TimeseriesTtbTests, cls).setUpClass() + def test_query_that_creates_table_using_interpolation(self): + table = self.randname() + query = """CREATE TABLE test-{table} ( + geohash varchar not null, + user varchar not null, + time timestamp not null, + weather varchar not null, + temperature double, + PRIMARY KEY((geohash, user, quantum(time, 15, m)), + geohash, user, time)) + """ + ts_obj = self.client.ts_query(table, query) + self.assertIsNotNone(ts_obj) + self.assertFalse(hasattr(ts_obj, 'ts_cols')) + self.assertIsNone(ts_obj.rows) + def test_query_that_returns_table_description(self): fmt = 'DESCRIBE {table}' query = fmt.format(table=table_name)