AAfghahi commented on code in PR #20281:
URL: https://github.com/apache/superset/pull/20281#discussion_r894725953


##########
superset/common/query_context_factory.py:
##########
@@ -80,6 +80,11 @@ def create(
 
     # pylint: disable=no-self-use
     def _convert_to_model(self, datasource: DatasourceDict) -> BaseDatasource:
-        return ConnectorRegistry.get_datasource(
-            str(datasource["type"]), int(datasource["id"]), db.session
+        from superset.dao.datasource.dao import DatasourceDAO

Review Comment:
   Is there a benefit to importing this in the function versus globally



##########
superset/models/sql_lab.py:
##########
@@ -167,8 +170,42 @@ def sql_tables(self) -> List[Table]:
         return list(ParsedQuery(self.sql).tables)
 
     @property
-    def columns(self) -> List[Table]:
-        return self.extra.get("columns", [])
+    def columns(self) -> List[ResultSetColumnType]:
+        # todo(hughhh): move this logic into a base class
+        from superset.utils.core import GenericDataType

Review Comment:
   Also why import this here?



##########
superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx:
##########
@@ -244,7 +244,13 @@ class DatasourceControl extends React.PureComponent {
     return (
       <Styles data-test="datasource-control" className="DatasourceControl">
         <div className="data-container">
-          <Icons.DatasetPhysical className="dataset-svg" />
+          {/* todo(hughhh): move this into a function */}
+          {datasource.type === DatasourceType.Table && (

Review Comment:
   Is this supposed to be an if and then statement?



-- 
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]

Reply via email to