villebro commented on a change in pull request #9161: fix: share column type
matching between model and result set
URL:
https://github.com/apache/incubator-superset/pull/9161#discussion_r387467690
##########
File path: tests/sqla_models_tests.py
##########
@@ -15,34 +15,56 @@
# specific language governing permissions and limitations
# under the License.
# isort:skip_file
-import tests.test_app
+from typing import Dict
+
from superset.connectors.sqla.models import SqlaTable, TableColumn
from superset.db_engine_specs.druid import DruidEngineSpec
-from superset.utils.core import get_example_database
+from superset.models.core import Database
+from superset.utils.core import DbColumnType, get_example_database
from .base_tests import SupersetTestCase
class DatabaseModelTestCase(SupersetTestCase):
def test_is_time_druid_time_col(self):
"""Druid has a special __time column"""
- col = TableColumn(column_name="__time", type="INTEGER")
+
+ database = Database(database_name="druid_db",
sqlalchemy_uri="druid://db")
+ tbl = SqlaTable(table_name="druid_tbl", database=database)
+ col = TableColumn(column_name="__time", type="INTEGER", table=tbl)
self.assertEqual(col.is_dttm, None)
DruidEngineSpec.alter_new_orm_column(col)
self.assertEqual(col.is_dttm, True)
- col = TableColumn(column_name="__not_time", type="INTEGER")
+ col = TableColumn(column_name="__not_time", type="INTEGER", table=tbl)
self.assertEqual(col.is_time, False)
Review comment:
I intended to refactor out `alter_new_orm_column` in this PR, but will leave
that for a later date to avoid convoluting this fix.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]