For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create DB table

Create tables ..

Workshop - Create DB table


Workshop files

Download the following files.

Keep the filenames unchanged.

Save them in your workshop folder.

Open
Open

Create databases

Create a new transformation

Use any of these options to open a new transformation tab:

  • Select File > New > Transformation

  • Use Ctrl+N (Windows/Linux) or Cmd+N (macOS)


Load Sales Data

Load sales data from a CSV file into STG_SALES_DATA.

Adjust field lengths to avoid truncation.

Load sales data

Follow the steps outlined below:

CSV File Input

Read a delimited file into a stream. Use Text File Input if you need more format options.

  1. Start Pentaho Data Integration.

Start Spoon

  1. Drag the CSV file input step onto the canvas.

  2. Open the CSV file input properties dialog box.

Configure these key fields:

  • Step name: csvi-sales_data

  • File name: ${Internal.Transformation.Filename.Directory}/sales_data.csv

  • Delimiter: , (comma)

  • Lazy conversion: clear

  • Header row present: select

If ${Internal.Transformation.Filename.Directory} is empty, save the transformation first.

  1. Ensure the following details are configured, as outlined below:

CSV file input
  1. Click on the Get Fields button.

  2. Select OK.

Table Output

Load rows into a database table. This step uses SQL INSERT.

  1. Drag the Table Output step onto the canvas.

  2. Open the Table Output properties dialog box. Ensure the following details are configured, as outlined below:

Table output - options
  1. Click on the Database fields.

  2. Click on the ‘Get Fields’ button.

Table output - fields
  1. Click on the SQL button.

SQL editor
  1. Select Execute.

  2. Select OK to close all dialogs.

RUN and validate

Use a database tool to verify results (DBeaver, Workbench, or your IDE). In production, you usually manage DDL with migrations or scripts.

  1. Click the Run button in the Canvas Toolbar.

  2. Confirm the table exists in your sampledata database.

STG_SALES_DATA

Load Orders

Load orders data from a delimited file into STG_ORDERS_MERGED.

Adjust field lengths to avoid truncation.

Load orders data

Follow the steps outlined below:

CSV File Input

Same setup as Workflow 1, but point to your orders file.

  1. Drag the CSV file input step onto the canvas.

  2. Open the CSV file input properties dialog box.

Ensure the following details are configured, as outlined below:

Add path to orders.txt
Set Content
Get Fields

Table Output

Load rows into a database table. This step uses SQL INSERT.

  1. Drag the Table Output step onto the canvas.

  2. Open the Table Output properties dialog box. Ensure the following details are configured, as outlined below:

Table output - options
  1. Click on the Database fields.

  2. Click on the ‘Get Fields’ button.

Table output -fields
  1. Click on the SQL button.

SQL editor
  1. Click Execute.

  2. Select OK to close all dialogs.

RUN and validate

Use a database tool to verify results.

  1. Click the Run button in the Canvas Toolbar.

  2. Confirm the table exists in your sampledata database.

STG_ORDERS_MERGED
Troubleshooting

“Table already exists” Disable table creation in Table Output, or drop the table first.

String truncation / data too long Increase field lengths in CSV File Input before you generate SQL.

SQL window is empty Select Get fields on the Database fields tab first.

Last updated

Was this helpful?