@@ -24,10 +24,6 @@ function toLF(str: string) {
2424 return str . replace ( / \r \n ? / g, '\n' ) ;
2525}
2626
27- function indentBlock ( str : string , pad = ' ' ) {
28- return str . replace ( / ^ / gm, pad ) ;
29- }
30-
3127export const createTableTemplate = ( params ?: SchemaQueryParams ) => {
3228 const tableName = params ?. relativePath
3329 ? `\`${ normalizeParameter ( params . relativePath ) } /my_row_table\``
@@ -333,8 +329,10 @@ export const createStreamingQueryTemplate = (params?: SchemaQueryParams) => {
333329 RUN = TRUE -- Run the query after creation
334330) AS
335331DO BEGIN
336- INSERT INTO \${2:<external data source>}.\${3:<sink topic>}
337- SELECT * FROM \${2:<external data source>}.\${4:<source topic>};
332+
333+ INSERT INTO \${2:<external data source>}.\${3:<sink topic>}
334+ SELECT * FROM \${2:<external data source>}.\${4:<source topic>};
335+
338336END DO;` ;
339337} ;
340338
@@ -360,14 +358,14 @@ export const alterStreamingQueryText = (params?: SchemaQueryParams) => {
360358 queryText = stripIndentByFirstLine ( queryText ) ;
361359 queryText = normalizeParameter ( queryText ) ;
362360
363- const bodyQueryText = queryText
364- ? indentBlock ( queryText )
365- : indentBlock ( '${2:<streaming_query_text>}' ) ;
361+ const bodyQueryText = queryText ? queryText : '${2:<streaming_query_text>}' ;
366362 return `ALTER STREAMING QUERY ${ streamingQueryName } SET (
367363 FORCE = TRUE, -- Allow to drop last query checkpoint if query state can't be loaded
368364) AS
369365DO BEGIN
366+
370367${ bodyQueryText }
368+
371369END DO;` ;
372370} ;
373371
0 commit comments