IBM Cloud Pak for Data

IBM Cloud Pak for Data

Come for answers. Stay for best practices. All we’re missing is you.

 View Only

Enterprise Text-to-SQL with Data Product Hub: Enabling Trusted Natural Language Data Access

By Sayan Pal posted 09/30/26 01:00 PM

  

Enterprise Text-to-SQL with Data Product Hub: Enabling Trusted Natural Language Data Access
Written by: @Bhanu Vamsi Priya Ammisetty, @Sayan Pal & @Sharon Ashok
Reviewed by: @SWATI NANDA

Introduction

Banks sit on some of the most valuable and sensitive data like: Customer profiles, loan portfolios, transaction histories and branch performance metrics.The challenge is not data availability but accessibility.

Problem Statement

Business users, Relationship Managers, Risk Officers, Branch Managers require simple data and have straightforward questions about the data on daily basis. Answering them still requires routing a request to an analyst, waiting for SQL to be written, reviewing the result, and restarting the cycle if the requirement shifts.This friction slows decisions, consumes analytical capacity on repetitive work, and creates inconsistency when business terms are interpreted differently across teams.

Text-to-SQL changes that equation. Instead of learning schemas or writing queries, a business user types a question in plain English or Natural Language. The AI understands the intent and generates the SQL needed to return trusted data in seconds.

In enterprise banking, data is regulated, access is role-based, customer information is sensitive, and every query needs to be audited. Hence a Text-to-SQL system that ignores governance cannot be adopted as a banking solution since it will become a compliance risk. Text-to-SQL, combined with IBM Data Product Hub on IBM Software Hub, solves this problem.

Data Product Hub acts as a governed semantic layer — organizing banking data into well-defined Data Products with business glossary terms, ownership, quality assurance, and access policies. Text-to-SQL generates SQL against these governed assets, ensuring that every query respects role-based access on data, uses agreed business definitions, and produces an auditable record.The result is a natural-language analytics experience that is both fast and compliant for a regulated banking environment.

Solution

This tutorial walks through how to combine Text-to-SQL with IBM Data Product Hub (DPH) on IBM Software Hub to build a governed, natural-language analytics experience for banking — covering every step from asset creation to Data Product subscription and query execution.

Persona setup

This tutorial involves four distinct personas that reflect a realistic enterprise banking deployment

Persona 1 — IBM Software Hub Admin (cpadmin)

  • Responsible for platform-level setup: creating user groups and roles, and configuring Data Product Hub so that producers and consumers can operate within a governed community.

Persona 2 — Data Engineer Group

  • Loads the banking dataset, creates the platform connection to the database, enables natural language queries on the Watson Studio project, and creates and tests the dynamic query (Text-to-SQL) asset. Publishes the asset to the governed catalog.

Persona 3 — Data Producer Group

  • Wraps the dynamic query asset into a governed Data Product with access terms and IKC policy enforcement, publishes it to the marketplace, and approves consumer subscriptions.

Persona 4 — Data Consumer Group

  • Discovers the Data Product in the marketplace, submits a subscription request, adds the approved asset to a project, and runs natural-language queries against the governed data — without writing any SQL.

Platform and Services

  • Data Intelligence
  • IBM Watson Studio
  • IBM watsonx.ai

Models Required

  • Foundation model: ibm/granite-4-h-small
  • Embedding model: ibm/granite-embedding-278m-multilingual

Data Requirement

  • A relational database connection available in CPD (Db2 or PostgreSQL)
  • The banking dataset must be available in the Database

Step 1: Add a Platform Connection

Persona: Data Engineer

  1. Log in to Cloud Pak for Data as a user with the Data Engineer role.
  2. From the navigation menu, select Data → Platform Connections.
  3. Click New connection.
  4. Select your database type (IBM Db2 or PostgreSQL).
  5. Provide the connection details.
  6. Click Test connection to verify connectivity, then click Create to save.



    Fig1 - Connection creation

Step 2: Create a Watson Studio Project and Add Collaborators

Persona: Data Engineer 

The dynamic query asset is created inside a Watson Studio project. After creating the project, add collaborators so the team can work together.

2.1 — Create the Project

  1. From the CPD home page, click Projects → New project.
  2. Select Create an empty project.
  3. Provide a Name: `Banking Text-to-SQL Project` and an optional Description.
  4. Click Create Once the project opens, go to the Assets tab.

2.2 — Add Collaborators to the Project

  1. From the project, click the Manage tab.
  2. In the left panel, click Access control.
  3. Click Add collaborators → select Add user groups from the dropdown.
  4. Add the Data Producers , Data Engineer user groups and assign the role Editor.
  5. Click Add. The user groups are added to the project immediately.




Fig2 - Create project and add collaborators

Step 3: Enable Natural Language Queries on the Project

Persona: Data Engineer

When you enable natural language queries on a project, CPD automatically starts an onboarding job named `Onboard for generative AI_<date-time>`. This job initializes the project for vectorization of metadata — the metadata of your connection assets and table schema is vectorized and stored so that the Text-to-SQL service can map plain-text questions to the correct tables and columns. Any metadata added after initialization is automatically processed and vectorized.

Steps to enable natural language queries:

  1. Open the Banking Text-to-SQL Project.
  2. Click the Manage tab.
  3. In the left panel, click Data intelligence settings.
  4. Scroll to the Natural language queries section.
  5. Click Enable.
  6. In the confirmation window, click Enable to confirm. A background onboarding job starts immediately.
  7. Navigate to the Jobs tab in the project and look for the Onboard for generative AI job. Wait for the job status to show Completed before proceeding to Step 4.

Note: If generative AI capabilities were not enabled during installation, this option will not appear. Contact your CPD administrator to enable Text-to-SQL at the platform level first. See: https://www.ibm.com/docs/en/cloud-paks/cp-data

Fig3 - Enable natural language queries

Step 4: Create the Dynamic Query Asset Using Text-to-SQL

Persona: Data Scientist

A dynamic query asset is a dynamic view of data created based on an SQL query against a connected data source. When Text-to-SQL is enabled, you can enter your query as plain natural language, and the AI model generates the SQL for you. In this step we create the asset against the SYNTHETIC_BANKINGDATA table — which contains customer behavioural and churn data for the retail banking use case.

4.1 — Add the Connection Asset to the Project

Before creating the dynamic view, a connection asset to your banking database must exist inside the project.

  1. From the project Assets tab, click New asset.
  2. Select Connection.
  3. Select Existing platform connection and choose the connection you created in Step 1.
  4. Click Create.

4.2 — Import the Data Asset from the Connection into the Project

Before the Text-to-SQL service can map your natural-language question to the correct table and columns, the data asset must be imported into the project from the connection. This makes the table schema visible to the vectorization job so that the model understands your data structure.

  1. From the project Assets tab, click New asset.
  2. Select Import Assets->Connected data.
  3. In the Select source panel, choose the connection asset you added in step 4.1.
  4. Browse the connection to locate your banking dataset.
  5. Click Select to confirm the table selection.
  6. Provide an optional name and description for the asset, then click Create.
  7. The connected data asset now appears in the project Assets tab.
  8. Go to the Jobs tab and check whether the `Onboard for generative AI` job has re-run since the asset was added. If it has not run automatically, go to Manage tab → Data intelligence settings → Natural language queries and click Sync nowto re-sync manually. Do not proceed until the job shows Completed.

Fig4 - Add connection and import asset

4.3 — Open the Dynamic View Creation Flow

  1. From the project Assets tab, click New asset
  2. Select Create a dynamic view of data.
  3. Enter a Name: Banking Customer Churn Analytics Dynamic Query and an optional Description.
  4. Optionally add tags for discoverability (e.g., loans, text-to-sql, banking).
  5. Under Select connection, choose the connection added to project.
  6. The connection must support SQL queries.

4.4 — Use Text-to-SQL to Generate the Query

  1. In the SQL tab, you will see a free-form text area for natural language input and a model selector icon
  2. Click the model selector and choose ibm/granite-4-h-small.
  3. In the free-form text area, type the natural language query:
    Example query:

         Which of my high-value customers are likely to churn this quarter and have not transacted in the last 90 days?
  4. Click Generate SQL. The system calls the Text-to-SQL service using the vectorized metadata from your project to map the intent of your question to the relevant columns in your dataset, and generates an SQL statement.
  5. The generated SQL will appear below the text area. It will look similar to:
    SELECT   "customer_id",  "income_bracket", "last_transaction_date", "transaction_frequency", "preferred_transaction_type" FROM "SYNTHETIC_BANKING_DATA"
    WHERE "income_bracket" = 'Premium'  AND "last_transaction_date" IS NOT NULL  AND "last_transaction_date" < CURRENT_DATE - INTERVAL '90' DAY ORDER BY "last_transaction_date" ASC;
    Note: The SQL shown here is based on the sample SYNTHETIC_BANKINGDATA table used in this tutorial.
  6. Review the generated SQL.
  7.  Click Test query to validate the SQL against your connected database and confirm it returns the expected data. Fix any SQL errors before proceeding.
  8.  Click Create. The dynamic query asset appears in the project Assets tab.



Fig5 - Dynamic query asset

Step 5: Create a Catalog and Publish the Dynamic Query Asset

Persona: Data Engineer
Before the dynamic query asset can be included in a Data Product, it must be published to a governed catalog in IBM Knowledge Catalog.

5.1 — Create a Governed Catalog

  1. From the CPD navigation menu, select Catalogs → View all catalogs.
  2. Click New catalog.
  3. Provide a Name: Banking Data Catalog and an optional Description.
  4. Toggle Enforce data policies to ON. This ensures that any data masking or access restriction rules defined in IKC are automatically enforced when assets in this catalog are accessed.
  5. Click Create.

5.2 — Add Collaborators to the Governed Catalog

  1. Open the Banking Data Catalog.
  2. Go to the Access control page.
  3. Click Add collaborators → select Add user groups from the dropdown.
  4. Add the Data Producers, Data Engineer user groups and assign the role Editor.
  5. Click Add. The user groups are added to the catalog immediately.

Fig6 - Create and add collaborators to the governed catalog

5.3 — Publish the Dynamic Query Asset to the Governed Catalog

  1. Return to the Banking Text-to-SQL Project.
  2. In the Assets tab, find the Banking Loan Analytics — Dynamic Query asset.
  3. Click the overflow menu next to the asset and select Publish to catalog.
  4. In the dialog, select Banking Data Catalog as the target catalog..
  5. Leave Review governance artifacts enabled — this allows IKC to assign any matching business terms and data classes to the asset metadata automatically.
  6. Click Publish. The asset is now available in the catalog and ready to be included in a Data Product.

Fig7 - Publish the asset to the governed catalog

Step 6: Set Up Data Product Hub and Create the Data Product

Persona: Data Product Producer

Data Product Hub is accessible via the Data Fabric experience in IBM Software Hub. You must switch to the Data Fabric experience before accessing DPH. This experience provides the full set of data governance, catalog, and data product sharing capabilities.

6.1 — Switch to the Data Fabric Experience

  1. Log in to Cloud Pak for Data.
  2. Click the experience switcher (grid icon or experience name) in the top navigation bar.
  3. Select Data Fabric from the list of available experiences.
  4. The navigation menu now shows Data Fabric capabilities including Data Product Hub.

6.2 — Add Members to the DPH Community

Before creating Data Products, ensure all relevant user groups are added as members of the DPH community. This is a one-time administrative setup performed by the platform admin.

  1. Log in as cpadmin and switch to the Data Fabric experience..
  2. From the navigation menu, select Configurations and settings
  3. Locate the Data Product Hub tile and click on it.
  4. Go to the Community section.
  5. Click Add members → select Add user groups from the dropdown.
  6. Add the Data Producers, Data Consumer, and Data Engineer user groups and assign the role Editor to each.
  7. Click Add. The user groups are now members of the DPH community and can browse, publish, and subscribe to Data Products in the marketplace.

Fig8 - Add collaborators to data product hub community.

6.3 — Create the Data Product

  1. From the Data Fabric navigation menu, select Data → Data Product Hub.
  2. Click New data product.
  3. Select Add from catalog assets and choose the asset from the catalog — select `Banking Data Catalog` as the source, find and select `Banking Customer Churn Analytics — Dynamic Query`, then click Add. A draft page opens.
  4. On the draft page, provide the product details — Name: `Retail Banking Analytics — Loan Queries`, Business domain:Banking & Finance. Click Next.
  5. Under Access, set the approval method to Request approval. Click Next.
  6. Enable the Visualization toggle to allow consumers to preview charts of the data before subscribing. Verify that the charts render correctly against the connected dataset. Click Next.
  7. Upload your data contract file (YAML or JSON format, conforming to the Open Data Contract Standard). Click Upload, select your contract file, then click Save. Click Next.
  8. Review the complete Data Product definition and click Publish.

The Data Product is now live in the DPH marketplace and visible to authorized community members.


Fig9: Create data product

Step 7: Discover, Subscribe, and Access the Data Product

Persona: Data consumer Group

7.1 — Browse the DPH Marketplace

  1. Log in to Cloud Pak for Data as the consumer user.
  2. Switch to the Data Fabric experience using the experience switcher in the top navigation bar.
  3. From the navigation menu, select Data → Data Product Hub.
  4. Click the Marketplace tab.
  5. Search for Retail Banking or browse the Banking & Finance category.
  6. Locate Retail Banking Analytics Loan Queries and click on it to review the product description, included assets, and terms of use.

7.2 — Request a Subscription

  1. Click Subscribe on the Data Product page.
  2. Fill in the subscription request form — provide a purpose (e.g., Quarterly loan portfolio review) and a requested access duration.
  3. Click Submit request. The request enters a pending state and the Data Producer is notified for approval.

Fig10 - Request a subscription

7.3 — Approve the Subscription

  1. Log in as the Data Producer.
  2. From the left navigation menu, click Task inbox.
  3. Locate the pending subscription request from the consumer — it appears as a task in the inbox.
  4. Click on the task to open it, then click Claim to take ownership of the approval.
  5. Review the stated purpose and consumer details, then click Approve.
  6. The consumer receives a notification that their subscription is active and the Data Product is delivered.

Fig11 - Approve the subscription

7.4 — Get the Flight Service Details from the Delivered Product

  1. As the consumer, navigate to Data → Data Product Hub → Marketplace → My subscriptions.
  2. Locate the approved subscription for Retail Banking Analytics Loan Queries and open it.
  3. The delivery page shows the Flight service URL along with the asset id and catalog id. Copy the Flight service URL and other details — these will be required for notebook.

Fig12 - Delivered product.

7.5 — Access the Data Product from a Jupyter Notebook

With the Flight service URL copied from the delivery page, you can use a Jupyter notebook in Watson Studio to connect to the Data Product and preview the data programmatically. Use the Flight client sample notebook provided in the IBM documentation to get started — it walks through connecting to the Flight service URL and loading the data product results for analysis.

Refer to the IBM documentation for the sample notebook: https://www.ibm.com/docs/en/watsonx/wdi/2.4.x?topic=products-flight-client-example-accessing-data-product

Conclusion

This tutorial demonstrated how Text-to-SQL and IBM Data Product Hub can be combined on IBM Software Hub to deliver a production-ready, governed natural-language analytics capability for banking. Business users can now query data in plain English and receive trusted, policy-enforced results — without raising a ticket, waiting for an analyst, or touching a database schema. Data teams retain full control through governed Data Products, role-based subscriptions and the Flight delivery method.

Follow the tutorial above on your IBM Software Hub environment and run your first natural-language query in minutes. 

0 comments
8 views

Permalink