Duplicate

You can duplicate a column and its contents using the Duplicate command. For example, the Buses demonstration app uses the Duplicate command to make a copy of a column with buses' speeds, toward creating a column that categorizes columns by fast, medium, and slow.

sl_duplicate

To use the Duplicate command:

1.Select one or more columns in the Output view and click the List of Columns button at the bottom of the Column List field. You can also enter the column names in the Column List field.

2.Enter a suffix for the new column(s), such as “_cat”.

A Suggestion appears that reads something along the lines of “Duplicate the column speed, adding the suffix _cat to the new column name”.

3.Click the + icon to add the command to the Guide script.

4.The duplicated column(s) appear(s) in the Output view.

Resulting SQL

You need not view or understand the SQL generated by a command in order to use them. However, some users may find it useful or interesting to view the SQL generated.

Like other commands, the Duplicate command generates a new view on the pipeline guide’s stream:


CREATE OR REPLACE VIEW "StreamLab_Output_Buses"."pipeline_1_step_1" AS

SELECT STREAM "speed" AS "speed_cat", *

FROM "StreamLab_Output_Buses"."buses" AS "input";

CREATE OR REPLACE VIEW "StreamLab_Output_Buses"."pipeline_1_out" AS SELECT  STREAM  * FROM "StreamLab_Output_Buses"."pipeline_1_step_1";

ALTER STREAM "StreamLab_Output_Buses"."buses" RESUME;