michael-s-molina commented on code in PR #35077:
URL: https://github.com/apache/superset/pull/35077#discussion_r2337587311


##########
superset-frontend/src/core/sqlLab.ts:
##########
@@ -16,19 +16,175 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import type { sqlLab as sqlLabType } from '@apache-superset/core';
+import { sqlLab as sqlLabType, core as coreType } from '@apache-superset/core';
 import {
   QUERY_FAILED,
   QUERY_SUCCESS,
   QUERY_EDITOR_SETDB,
   querySuccess,
+  startQuery,
+  START_QUERY,
+  stopQuery,
+  STOP_QUERY,
+  createQueryFailedAction,
 } from 'src/SqlLab/actions/sqlLab';
 import { RootState, store } from 'src/views/store';
 import { AnyListenerPredicate } from '@reduxjs/toolkit';
 import type { SqlLabRootState } from 'src/SqlLab/types';
 import { Disposable, Editor, Panel, Tab } from './core';
 import { createActionListener } from './utils';
 
+const { CTASMethod } = sqlLabType;
+
+export class CTAS implements sqlLabType.CTAS {
+  method: sqlLabType.CTASMethod;
+
+  tempTable: string;
+
+  constructor(asView: boolean, tempTable: string) {
+    this.method = asView ? CTASMethod.View : CTASMethod.Table;
+    this.tempTable = tempTable;
+  }
+}
+
+export class QueryContext implements sqlLabType.QueryContext {
+  clientId: string;
+
+  ctas: sqlLabType.CTAS | null;
+
+  editor: Editor;
+
+  requestedLimit: number | null;
+
+  runAsync: boolean;
+
+  startDttm: number;
+
+  tab: Tab;
+
+  private templateParams: string;
+
+  constructor(
+    clientId: string,
+    tab: Tab,
+    runAsync: boolean,
+    startDttm: number,
+    options: {
+      templateParams?: string;
+      ctasMethod?: string;
+      tempTable?: string;
+      requestedLimit?: number;
+    } = {},
+  ) {
+    this.clientId = clientId;
+    this.tab = tab;
+    this.runAsync = runAsync;
+    this.startDttm = startDttm;
+    this.requestedLimit = options.requestedLimit ?? null;
+    this.ctas = options.tempTable
+      ? new CTAS(options.ctasMethod === CTASMethod.View, options.tempTable)
+      : null;
+    this.templateParams = options.templateParams ?? '';
+  }
+
+  get templateParameters() {

Review Comment:
   It would be good to add a comment explaining that we want to do the parsing 
only when the property is accessed. That's why we didn't add to the constructor.



-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to