From 3742f86d166160ca3843872ebecb6f30c51f6085 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 14 Aug 2023 12:12:19 +0200 Subject: Merging upstream version 17.12.0. Signed-off-by: Daniel Baumann --- tests/test_executor.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/test_executor.py') diff --git a/tests/test_executor.py b/tests/test_executor.py index 9dacbbf..ffe0229 100644 --- a/tests/test_executor.py +++ b/tests/test_executor.py @@ -723,3 +723,24 @@ class TestExecutor(unittest.TestCase): result = execute(sql, tables=tables) self.assertEqual(result.columns, columns) self.assertEqual(result.rows, expected) + + def test_dict_values(self): + tables = { + "foo": [{"raw": {"name": "Hello, World"}}], + } + result = execute("SELECT raw:name AS name FROM foo", read="snowflake", tables=tables) + + self.assertEqual(result.columns, ("NAME",)) + self.assertEqual(result.rows, [("Hello, World",)]) + + tables = { + '"ITEM"': [ + {"id": 1, "attributes": {"flavor": "cherry", "taste": "sweet"}}, + {"id": 2, "attributes": {"flavor": "lime", "taste": "sour"}}, + {"id": 3, "attributes": {"flavor": "apple", "taste": None}}, + ] + } + result = execute("SELECT i.attributes.flavor FROM `ITEM` i", read="bigquery", tables=tables) + + self.assertEqual(result.columns, ("flavor",)) + self.assertEqual(result.rows, [("cherry",), ("lime",), ("apple",)]) -- cgit v1.2.3