Tutorial
Create and manage DataStage pipelines using IBM Bob and watsonx.data integration
A hands-on guide to building, running, monitoring, and troubleshooting DataStage ETL pipelines in watsonx.data Integration using IBM Bob and natural language promptsBuilding Extract, Transform, and Load (ETL) pipelines often requires switching between a code editor, a pipeline designer, and a job monitoring interface. Each tool has its own workflow, which can slow down pipeline development and operations. IBM Bob simplifies this process by exposing the full watsonx.data Integration API through a Model Context Protocol (MCP) server, so that you can create flows, run jobs, review logs, and configure alerts by using natural language prompts from a single conversational interface.
This tutorial uses a retail data integration scenario. Five regional systems generate approximately 200 customer orders each day, and each system uses a different date format. Before the data can be used for analytics, it must be filtered, standardized, and cleaned. A nightly ETL pipeline extracts data from PostgreSQL, transforms the records, writes the cleaned output to a sequential file, and monitors pipeline execution for failures.
In this tutorial, you use Bob to connect to the MCP server, explore project assets, create a DataStage flow, create and run a DataStage job, review execution metrics and logs, and configure job failure alerts by using natural language prompts. By the end of the tutorial, you will have completed the full ETL lifecycle, from source data discovery and pipeline development to execution, monitoring, troubleshooting, and alerting, through a single Bob conversation.
Architecture of the AI-driven ETL pipeline
This solution uses Bob, the ibm-agent-data-intg MCP server, and watsonx.data Integration to build, run, and monitor a DataStage ETL pipeline through a single conversation.

Bob serves as the user interface for the solution. The wxdi-data-intg skill and wxdi-intg-engineer custom mode help you create flows, run jobs, view logs, and configure alerts by using natural language prompts.
The ibm-agent-data-intg MCP server connects Bob to watsonx.data Integration. It exposes DataStage functions as MCP tools and translates natural language requests into DataStage operations.
watsonx.data Integration provides the DataStage runtime, APIs, job orchestration, and monitoring services that are required to build and manage the ETL pipeline.
The retail_order_ETL DataStage flow contains three stages:
Orders_Sourceextracts customer order data from PostgreSQL.Transform_Ordersfilters records and standardizes date formats.SF_Cleaned_Orderswrites the cleaned data to a Sequential File.
The monitoring layer tracks job execution and generates alerts when failures occur. A high-severity job-failure alert helps operators quickly identify and investigate pipeline issues.
Data schema
The ETL flow processes 11 columns:
| Column type | Columns |
|---|---|
| INTEGER | order_id, customer_id, product_id, quantity |
| VARCHAR | customer_name, product_name, order_status, order_date, region |
| DECIMAL | unit_price, total_amount |
Solution workflow
Each natural language prompt that you submit in Bob maps to one or more MCP tool calls.
- Connect and configure: Connect Bob, enable the
wxdi-data-intgskill, and activate thewxdi-intg-engineercustom mode. - Discover and build: Discover source systems and create the three-stage DataStage flow.
- Run the pipeline: Execute the
retail_order_ETLjob and review job status and logs. - Configure monitoring: Create a high-severity job-failure alert.
- Review results: Verify the cleaned output file and monitor pipeline operations.
The result is a complete ETL workflow that supports pipeline development, execution, monitoring, and alert management from a single Bob conversation.
Prerequisites
Before you begin, make sure you have access to the following resources:
- Access to IBM Bob. Sign up for a free access to IBM Bob.
- An IBM Cloud account with watsonx.data and watsonx.data data integration enabled.
- An
ibm-agent-data-intgAPI key from your watsonx.data Integration service credentials. - A PostgreSQL database. You can use IBM Cloud Databases for PostgreSQL or any accessible PostgreSQL instance.
- Python 3.8 or later to run the data seeding script used in this tutorial.
- Basic familiarity with DataStage concepts, including connections, flows, and jobs.
Step 1. Prepare and load the sample retail order data
In this step, you prepare the tutorial files and load the sample retail order data into a PostgreSQL database. You install the required Python package, configure the PostgreSQL connection, and load 200 retail order records into the retail.orders table. The DataStage pipeline uses this table as the source dataset later in the tutorial.
Create a folder for the tutorial files on your system. For example, name the folder
datastage-etl-pipeline.Save the orders_data.csv and ingest_csv_to_pgsql.py files in that folder on your system.
The Python script uses the
psycopg2library to connect to the PostgreSQL database. Install thepsycopg2-binarypackage before you run the script.pip install psycopg2-binaryYou should see output similar to the following. The package version might be different.
Collecting psycopg2-binary Downloading psycopg2_binary-2.9.12-cp39-cp39-macosx_11_0_arm64.whl (3.8 MB) Installing collected packages: psycopg2-binary Successfully installed psycopg2-binary-2.9.12The Python
csvandsysmodules are part of the Python standard library, so you do not need to install them separately.Configure the PostgreSQL connection details. Update the following values with your PostgreSQL credentials in
ingest_csv_to_pgsql.pyand save the file.PG_HOST = "<YOUR_PG_HOST>" PG_USER = "<YOUR_PG_USER>" PG_PASSWORD = "<YOUR_PG_PASSWORD>"Run the following command to load the sample data.
python ingest_csv_to_pgsql.py orders_data.csvThe script creates the
retailschema, creates theretail.orderstable, and loads the records fromorders_data.csv.Verify the imported data. Run the following SQL query.
SELECT order_status, COUNT(*) FROM retail.orders GROUP BY order_status;The output is similar to the following example.
order_status | count -------------+------- completed | 147 cancelled | 22 pending | 31 (3 rows)The output confirms that the sample retail order data loaded successfully.

The
retail.orderstable contains 11 columns, including customer details, product information, order status, order value, order date, and region. Theorder_datecolumn contains multiple date formats, which represent a common data quality issue found in real-world data integration projects.
Step 2. Create a PostgreSQL connection in watsonx.data Integration
The DataStage flow needs a connection to the PostgreSQL database that contains the retail order data. In this step, you create a reusable PostgreSQL connection in watsonx.data Integration. You use this connection later when you build the retail_order_ETL flow.
Sign in to IBM Cloud and select watsonx.data integration from the resource list.

Open watsonx.data integration and navigate to your project.

Click Assets → New asset → Connection.

From the connector catalog, select IBM Cloud Databases for PostgreSQL.

Provide the PostgreSQL connection information.
Field Value Connection name Your connection name Host Your PostgreSQL hostname Port Your PostgreSQL port Database Your PostgreSQL database name Username Your PostgreSQL username Password Your PostgreSQL password SSL Required 
Click Test connection. Verify that the connection test succeeds.
Click Save.

The PostgreSQL connection is now available in your project and you can use it as the source connection for the
retail_order_ETLDataStage flow.
Step 3. Register the watsonx.data Integration MCP server in IBM Bob
Bob uses MCP servers to access external tools and services. In this step, you register the ibm-agent-data-intg MCP server and connect it to your watsonx.data Integration instance by using an API key. After the connection is established, Bob can create DataStage flows, run jobs, retrieve logs, and configure alerts through natural language prompts.
- Open the Bob chat panel.
Click Settings → MCP → Open global MCP config.

Add the following configuration in the
mcpServersobject. Replace<YOUR_API_KEY>with your watsonx.data Integration API key."ibm-agent-data-intg": { "type": "streamable-http", "url": "https://api.ca-tor.dai.cloud.ibm.com/data_intg_ai/v1/mcp", "headers": { "Authorization": "ApiKey <YOUR_API_KEY>" }, "disabled": false, "alwaysAllow": [ "get_projects", "list_connections", "list_data_assets", "list_datastage_flows", "inspect_project_asset", "create_datastage_flow", "update_datastage_flow", "create_job", "create_job_run", "list_jobs", "list_job_runs", "poll_datastage_job", "get_job_run_logs", "get_job_run_details", "create_alert_definition", "list_alert_definitions", "list_alerts", "get_alerts_summary" ] }Save the configuration file. Restart Bob.
Open the MCP server list and confirm that
ibm-agent-data-intgappears with a Connected status.
After the MCP server is connected, Bob can access watsonx.data Integration tools and perform DataStage operations through a single conversational interface.
Step 4. Create the Bob skill
Bob skills provide reusable instructions for specific tasks. In this step, you create a wxdi-data-intg custom skill that helps Bob work with watsonx.data Integration and DataStage. The skill defines when Bob activates it, which MCP tools to use, and how to perform common DataStage operations.
Download the SKILL.md file and save it in the following location in your workspace.
.bob/skills/wxdi-data-intg/SKILL.mdThe skill contains:
- A
descriptionfield that automatically activates the skill for DataStage and data integration requests. - A tool reference section that maps
ibm-agent-data-intgtools to their functions. - Workflow instructions for creating flows, running jobs, monitoring executions, scheduling jobs, and configuring alerts.
Troubleshooting guidance for common DataStage issues.

- A
Step 5. Create the Bob custom mode
Custom modes give Bob a focused role and a predefined set of tools. In this step, you create a wxdi-intg-engineer custom mode for watsonx.data Integration tasks. The mode automatically loads the wxdi-data-intg skill and limits Bob to DataStage and data integration tools.
Open the following file.
~/.bob/settings/custom_modes.yamlAdd the following configuration:
- slug: wxdi-intg-engineer name: "watsonx.data Integration Engineer" roleDefinition: >- You are a watsonx.data Integration specialist. Use the ibm-agent-data-intg MCP server tools to manage DataStage flows, jobs, and alerts. Always resolve project IDs, flow names, and job IDs from live tool calls. Never hard-code or guess identifiers. Present all results as markdown tables. groups: - read - edit - mcpOpen the Bob chat panel.
Click the mode picker at the bottom of the Bob chat panel.
Select watsonx.data Integration Engineer.

Start a new conversation and enter a DataStage request such as:
List my DataStage flowsor
Create a DataStage flowBob should activate the
wxdi-data-intgskill automatically and use theibm-agent-data-intgMCP tools to perform the requested task.The
wxdi-intg-engineercustom mode is now ready to support DataStage flow development, job execution, monitoring, scheduling, and alert management through natural language conversations.
Step 6. Explore the watsonx.data integration project
Before you build the DataStage flow, use IBM Bob to review the available project, database connection, and source table. Bob uses the ibm-agent-data-intg MCP tools to retrieve the current project details from watsonx.data integration.
List the projects
Ask Bob:
List my watsonx.data Integration projects.Bob uses the
get_projectsMCP tool and returns the available projects:Project name Project ID Default Data Product Delivery Project <YOUR_PROJECT_ID>
List the project connections
Ask Bob:
What connections are available in my project?Bob uses the
list_connectionsMCP tool and returns the available database connections:Name Data source type retail-postgresql-dbIBM Cloud Databases for PostgreSQL 
Inspect the source table
Ask Bob:
What columns does the retail.orders table have?Bob uses the
discover_connection_dataMCP tool and calls the tool with the following path:/retail/ordersBob returns the 11 columns in the
retail.orderstable:Column Type Nullable order_idINTEGER No customer_idINTEGER Yes customer_nameVARCHAR(100) Yes product_idINTEGER Yes product_nameVARCHAR(100) Yes quantityINTEGER Yes unit_priceNUMERIC Yes total_amountNUMERIC Yes order_statusVARCHAR(20) Yes order_dateVARCHAR(30) Yes regionVARCHAR(50) Yes 
The results confirm that Bob can access the watsonx.data integration project, the
retail-postgresql-dbconnection, and theretail.orderssource table. The PostgreSQL data is now ready for the DataStage flow.
Step 7. Create the DataStage flow
In this step, you use Bob to create a complete DataStage ETL pipeline. Bob uses the ibm-agent-data-intg MCP tools to create the flow, define the stages, configure the links, and compile the pipeline. The resulting retail_order_ETL flow reads retail order data from PostgreSQL, transforms the records, and writes the output to a sequential file.
Ask Bob.
Create a DataStage flow called retail_order_ETL in the Default Data Product Delivery Project with three stages. Before writing any SDK code: 1. Call get_projects to resolve the project ID 2. Call list_connections to get the asset ID of retail-postgresql-db 3. Call list_datastage_flows to check if retail_order_ETL already exists - If it exists: use update_datastage_flow with preserve_parameters=True - If it does not exist: use create_datastage_flow Stage 1 — PostgreSQL source (PG_Source) - Stage type: IBM Cloud Databases for PostgreSQL - Connection: pg_source.configuration.connection.asset_id = "<retail-postgresql-db asset ID from list_connections>" Do NOT use project.connections.get(name=...) — it triggers vault resolution and causes compile errors - Schema: retail, Table: orders - Select statement: SELECT * FROM retail.orders - Read method: POSTGRESQL_IBMCLOUD.ReadMethod.general - Runtime column propagation: pg_source.configuration.runtime_column_propagation = True Stage 2 — Transformer (Transformer) - Runtime column propagation: transformer.configuration.runtime_column_propagation = True - Output link named Link_2, all 11 columns passed through using source="Link_1.<column_name>" on each add_field call Stage 3 — Sequential File sink (SeqFile_Sink) - Stage type string: "Sequential file" ← lowercase 'f', exactly as shown - file: ["cleaned_orders.csv"] - first_line_is_column_names: SEQUENTIALFILE.FirstLineColumnNames.true - file_update_mode: SEQUENTIALFILE.AppendOverwrite.overwrite - create_data_asset: True - data_asset_name: "cleaned_orders" - Do NOT set force_sequential Link schema — Link_1 (PG_Source → Transformer), Link_2 (Transformer → SeqFile_Sink): order_id INTEGER customer_id VARCHAR length=20 customer_name VARCHAR length=100 product_id VARCHAR length=20 product_name VARCHAR length=100 quantity INTEGER unit_price DECIMAL length=10, precision=10, scale=2 total_amount DECIMAL length=10, precision=10, scale=2 order_status VARCHAR length=20 order_date VARCHAR length=20 region VARCHAR length=50 SDK rules (must follow exactly): - Schema objects MUST be created with link.create_schema() before calling add_field CORRECT: pg_source_schema = link_1.create_schema() pg_source_schema.add_field("VARCHAR", "customer_id", length=20) WRONG: schema_1 = link_1.schema schema_1.add_field(...) WRONG: link_1.schema.add_field(...) - add_field signature: first arg = type string, second arg = column name string CORRECT: schema.add_field("VARCHAR", "customer_id", length=20) WRONG: schema.add_field(name="customer_id", data_type=DataType.VARCHAR, length=20) - DECIMAL fields must always include precision= alongside length= and scale= - Transformer output columns use source= on each add_field call on link_2's schema CORRECT: transformer_schema.add_field("VARCHAR", "customer_id", length=20, source="Link_1.customer_id") WRONG: transformer.add_output_column("customer_id", source="Link_1.customer_id") - connect_output_to() takes the stage variable as first arg, not a string CORRECT: link_1 = pg_source.connect_output_to(transformer) WRONG: link_1 = pg_source.connect_output_to("Transformer", "Link_1") - Set link name after connect_output_to: link_1.name = "Link_1" - Runtime column propagation must go through configuration: CORRECT: pg_source.configuration.runtime_column_propagation = True WRONG: pg_source.runtime_column_propagation = True - Do NOT set host, port, database, username, or password on the stage — invalid stage properties - Do NOT set connection via project.connections.get() — use connection.asset_id onlyBob performs the following tasks:
- Resolves the project ID.
- Retrieves the PostgreSQL connection asset ID.
- Checks whether the
retail_order_ETLflow already exists. - Creates or updates the DataStage flow.
- Validates stage properties and link schemas.
- Compiles the DataStage flow.
During flow creation, Bob uses the following MCP tools:
get_projectsto resolve the project ID.list_connectionsto retrieve the PostgreSQL connection.list_datastage_flowsto check for an existing flow.datastage_property_lookupto validate stage properties.create_datastage_flowto create the flow.update_datastage_flowto update the flow schema and configuration when required.
Bob creates a three-stage ETL pipeline:
Stage Purpose PG_SourceReads data from the retail.ordersPostgreSQL tableTransformerProcesses records and passes all 11 columns through the pipeline SeqFile_SinkWrites the cleaned data to cleaned_orders.csvAfter the flow compiles successfully, Bob returns a response similar to the following:
Flow compiled successfully. Flow: retail_order_ETL Stages: PG_Source → Transformer → SeqFile_Sink Link: https://<FLOW_URL>
Open the watsonx.data Integration project and locate the
retail_order_ETLflow.
Open the flow to review the pipeline design, stage configuration, link definitions, and data movement path.

Step 8. Create a DataStage job
A DataStage flow must have a job before it can run. In this step, you use Bob to create a job for the retail_order_ETL flow. The job provides the runtime configuration that DataStage uses to execute the pipeline.
Ask Bob.
Create a job for the retail_order_ETL flowBob uses the
create_jobMCP tool and returns a response similar to the following:Job created successfully. Job name: retail_order_ETL.DataStage job Flow: retail_order_ETL
Open the
retail_order_ETLflow in watsonx.data integration and confirm that the following job is available.retail_order_ETL.DataStage job
Step 9. Run the DataStage job
With the DataStage flow and job in place, you can run the ETL pipeline. In this step, Bob starts the job, monitors its progress, and returns the execution results. After the job completes, you can review the processing statistics and job details in watsonx.data Integration.
Ask Bob.
Run the retail_order_ETL job nowBob uses the following MCP tools:
create_job_runto start the job.poll_datastage_jobwithtimeout=-1to monitor the job until it reaches a final state.
Bob returns a response similar to the following:
Job run completed successfully. Status: Completed Duration: 2 seconds Total stages: 3 Rows read: 200 Rows written: 200 Stage breakdown: PG_Source — read 200 rows Transformer — read 200 rows, wrote 200 rows SeqFile_Sink — wrote 200 rows to cleaned_orders.csvOpen the retail_order_ETL.DataStage job in watsonx.data Integration. Select the latest job run to view:
- Job status
- Execution duration
- Stage metrics
- Link metrics
Execution logs

A successful run confirms that the pipeline read 200 records from PostgreSQL, processed the records through the transformer stage, and wrote 200 records to the output file.

Note: If a subsequent job run fails with the following error, the Sequential file stage is not configured to overwrite an existing output file.
Fatal Error: File DataStage/files//tmp/cleaned_orders.csv exists on COS; it will not be overwritten.Verify that the flow contains the following setting:
snk.configuration.file_update_mode = SEQUENTIALFILE.AppendOverwrite.overwriteIf the setting is missing, update the flow by using the
update_datastage_flowMCP tool and run the job again.
Step 10. Review job run details and execution logs
After the job completes, you can inspect the execution metrics and runtime logs. Bob can retrieve stage statistics, link statistics, and log entries from the most recent job run. These details help you verify the pipeline results and troubleshoot issues when a job fails.
Ask Bob.
Show me the details of the last retail_order_ETL runBob uses the
get_job_run_detailsMCP tool and returns information similar to the following:

The stage and link metrics confirm that 200 records moved through the pipeline successfully.
Review the execution logs. Ask Bob.
Show me the logs for the last retail_order_ETL runBob uses the
get_job_run_logsMCP tool and filters the logs to show errors, warnings, and fatal messages only. For a successful job run, the log output contains informational messages and no errors or warnings.
Step 11. Create a job failure alert
Production ETL pipelines should notify operators when a job fails. In this step, you use Bob to create a high-severity alert for the retail_order_ETL job. The alert helps you detect failures quickly and respond before downstream systems are affected.
Ask Bob.
Alert me if the retail_order_ETL job fails. Severity high.Bob uses the
create_alert_definitionMCP tool and creates the alert with the following settings:- Alert type:
JobRunState - Condition:
this.state == 'failed' - Severity:
high - Monitored job:
retail_order_ETL.DataStage job
Bob returns a response similar to the following:

- Alert type:
Verify the alert definition. Ask Bob.
Are there any active alert definitions for my project?Bob uses the
list_alert_definitionsMCP tool and returns the active alert definitions:
The alert is now active and monitors the
retail_order_ETL.DataStage job. If a future job run fails, watsonx.data Integration generates an alert so that you can investigate the issue immediately.
Summary
In this tutorial, you built an end-to-end ETL pipeline by using natural language prompts instead of manually configuring pipeline components. You started by loading sample retail order data into a PostgreSQL database, created the required connections and configurations, and explored available project assets.
You then created a DataStage flow to extract data from PostgreSQL, transform the records, and write the output to a file. After creating the flow, you created and ran a DataStage job, reviewed execution metrics and logs, and verified that the pipeline processed the data successfully.
You also configured a job failure alert to monitor pipeline health and improve operational visibility. By the end of the tutorial, you completed the full ETL lifecycle, including data preparation, pipeline creation, job execution, monitoring, troubleshooting, and alerting, through a single conversational interface.