villebro commented on code in PR #22435:
URL: https://github.com/apache/superset/pull/22435#discussion_r1050452137
##########
tests/integration_tests/db_engine_specs/trino_tests.py:
##########
@@ -196,3 +198,17 @@ def test_convert_dttm(self):
TrinoEngineSpec.convert_dttm("DATE", dttm),
"DATE '2019-01-02'",
)
+
+ def test_extra_table_metadata(self):
+ db = mock.Mock()
+ db.get_indexes = mock.Mock(
+ return_value=[{"column_names": ["ds", "hour"], "name":
"partition"}]
+ )
+ db.get_extra = mock.Mock(return_value={})
+ db.has_view_by_name = mock.Mock(return_value=None)
+ db.get_df = mock.Mock(
+ return_value=pd.DataFrame({"ds": ["01-01-19"], "hour": [1]})
+ )
+ result = TrinoEngineSpec.extra_table_metadata(db, "test_table",
"test_schema")
+ assert result["partitions"]["cols"] == ["ds", "hour"]
+ assert result["partitions"]["latest"] == {"ds": "01-01-19", "hour": 1}
Review Comment:
nit: we should add new db engine spec tests to
`tests/unit_tests/db_engine_specs/test_*.py`. But I can port over this test
once this PR is merged, as I'm going to be doing a few changes to the Trino
spec to implement some recent features from the new Trino driver.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]