Example 1: Using MS-SQL Connector as a Source

Transfer customer information from MS-SQL table to a Langstack entity.

Solution

To create an ETL pipeline that transfers customer data from an MS-SQL table to a Langstack entity, follow the steps below.

  • To go to the ETL pipeline template, click on “ETL pipeline” under the “Data management” menu on the left side panel.

  • To create a new ETL pipeline, click the [+ ETL pipeline] button under the “ETL pipeline” tab.

  • To label the ETL pipeline and execution log entity, add the following information:

    • Enter the ETL pipeline name as “Tutorial_MSSQL_to_entity”.

    • Optionally add a description for this ETL pipeline.

  • Enter a name for the execution log for this ETL pipeline as “Tutorial_MS-SQL_to_entity”. This log will be updated each time the ETL pipeline is executed and can be viewed by clicking “Go to records”.

  • To connect to the data source, add the necessary information needed in the Data source section:

    • Select the “Connector” tab.

    • For this exercise, “MS-SQLconn” is selected from the drop down menu. The connector can be added by selecting a connector from the drop down menu or a new connector can be created by clicking the [+] button.

    • Click the “Edit the settings” arrow. In the settings, to add or update the details for the MS-SQL Connector, update the required fields.

  • To connect to the data destination, add the necessary information needed in the Data destination section:

    • Select the “Entity” tab.

    • Select “TEST_MS-SQL_Entity” from the drop down menu.

  • To disallow multiple simultaneous runs of the ETL pipeline, leave the toggle button enabled for “skip execution while in progress”. Enabling this toggle button defines that the execution of this ETL pipeline will be skipped when there is one already in progress.

  • The default selection for ETL pipeline execution is “Immediate”. For this exercise, keep it as is.

  • To align the source fields with destination fields, click on the “Data Format” tab. In this tab, the settings for the reader and writer format are defined (based on the settings for the data source and the data destination). The “Reader” tab is selected by default.

  • To update the settings for how the data from the source should be read from the source:

    • Select writer stream as “Database Stream”.

    • Click the “Edit the settings” arrow.

  • To add details necessary to write the records, define the settings in this section “MS-SQL format details”:

    • Add the MS-SQL table name.

    • Click the [Accept & Collapse] button. This will save the information related to the destination table. For this exercise, the table used as a source is “TEST_MSSQL”. This is the name of the table that the ETL pipeline will write the data in. This name must be exactly the same as the name for the destination table name.

  • In the Source fields section, click the [+Field] button to add source fields.

  • Define all the fields. For this exercise, four fields have been added as per the image below.

  • To define that the data is written to the destination as mentioned in reader source fields without transforming it, select “Writer Mode” as “Append”.

  • To map the reader source fields to the entity destination fields, select the “Field Mapping” tab.

  • To add the Mapped Fields, click the [+ Field] button and add relevant information.

  • To align the fields, add the following information:

    • Select the “Reader” field in “Mapping Sources” by clicking the drop down menu. e.g. in case of Customer ID, click on the “Mapping sources” drop down menu, select Variables> reader>customer_id.

    • Enter destination column to map the reader field to in Mapped to e.g. in case of customer ID, enter “customer_id”. It is important that the destination table column name is exactly the same as the name entered in this field.

    • The data type of the entity field is populated.

    • Select readonly field to define that the data can be written once to the destination but it cannot be updated afterwards. As per the term “readonly”, the data in the field marked as readonly can only be read and not edited once written.

  • Add all the “Mapped Fields”.

  • To save the ETL pipeline, click [Save].

  • To publish the ETL pipeline, click [Publish].

  • Ensure the ETL pipeline is enabled.

  • Click the [Run] button.

  • The Run ETL pipeline dialog box displays. Click [Run] to execute the ETL pipeline.

  • The ETL pipeline will be executed and the records will be added to the destination file. The bit data type in MS-SQL is mapped to the boolean data type in Langstack in case of the field “active_status”. The 0 is converted to false and 1 is converted to true.

    “activity_status” field in source:

    “activity_status” field in destination:

Last updated