IBM watsonx.data
Since Camel 4.19
Only producer is supported
The IBM watsonx.data component provides integration with IBM watsonx.data, an open lakehouse platform for data analytics and AI workloads. It allows you to manage catalogs, schemas, tables, query engines, and storage registrations programmatically.
This component is built on top of the IBM watsonx.data Java SDK.
Prerequisites
You must have a valid IBM Cloud account with access to watsonx.data services. More information is available at IBM watsonx.data.
To use this component, you need:
-
An IBM Cloud API key
-
The watsonx.data service URL for your region
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The IBM watsonx.data component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
The ID of the watsonx.data instance (on IBM Cloud, the CRN of the instance), sent in the AuthInstanceId HTTP header of every request. The CamelIBMWatsonxDataAuthInstanceId header overrides it; when neither is set, the request has no AuthInstanceId header. | String | ||
Required The base URL of the watsonx.data REST API, to which the IBM SDK appends the resource paths, for example https://us-south.lakehouse.cloud.ibm.com/lakehouse/api/v3. The endpoint does not start without it. | String | ||
The name of the catalog for getCatalog, deleteCatalog, getAllColumns and the schema and table operations, except registerTable, which takes the catalog ID header instead. The CamelIBMWatsonxDataCatalogName header overrides it. | String | ||
The configuration that the endpoints share. Each endpoint starts from a copy of it, and its URI options override the copied values. | WatsonxDataConfiguration | ||
The ID of the engine that the schema and table operations, except registerTable, run on, and of the engine that getPrestoEngine and getPrestissimoEngine return. The CamelIBMWatsonxDataEngineId header overrides it. | String | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
The operation to perform. The CamelIBMWatsonxDataOperation header overrides it; when neither is set, the exchange fails. Enum values:
| WatsonxDataOperations | ||
The name of the schema for deleteSchema and the table operations, except registerTable; getAllColumns returns only the columns of this schema. The CamelIBMWatsonxDataSchemaName header overrides it. createSchema ignores this option and takes the name of the new schema from the header only. | String | ||
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | |
The IBM Cloud API key, exchanged at IBM Cloud IAM for an access token that is sent to watsonx.data. Required unless oauthProfile is set; when both are set, oauthProfile is used. | String | ||
OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token of the configured identity provider is sent to watsonx.data as a Bearer token instead of an IBM Cloud API key, and obtained again when it expires. Requires camel-oauth on the classpath. | String |
Endpoint Options
The IBM watsonx.data endpoint is configured using URI syntax:
ibm-watsonx-data:label
With the following path and query parameters:
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
The ID of the watsonx.data instance (on IBM Cloud, the CRN of the instance), sent in the AuthInstanceId HTTP header of every request. The CamelIBMWatsonxDataAuthInstanceId header overrides it; when neither is set, the request has no AuthInstanceId header. | String | ||
Required The base URL of the watsonx.data REST API, to which the IBM SDK appends the resource paths, for example https://us-south.lakehouse.cloud.ibm.com/lakehouse/api/v3. The endpoint does not start without it. | String | ||
The name of the catalog for getCatalog, deleteCatalog, getAllColumns and the schema and table operations, except registerTable, which takes the catalog ID header instead. The CamelIBMWatsonxDataCatalogName header overrides it. | String | ||
The ID of the engine that the schema and table operations, except registerTable, run on, and of the engine that getPrestoEngine and getPrestissimoEngine return. The CamelIBMWatsonxDataEngineId header overrides it. | String | ||
The operation to perform. The CamelIBMWatsonxDataOperation header overrides it; when neither is set, the exchange fails. Enum values:
| WatsonxDataOperations | ||
The name of the schema for deleteSchema and the table operations, except registerTable; getAllColumns returns only the columns of this schema. The CamelIBMWatsonxDataSchemaName header overrides it. createSchema ignores this option and takes the name of the new schema from the header only. | String | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
The IBM Cloud API key, exchanged at IBM Cloud IAM for an access token that is sent to watsonx.data. Required unless oauthProfile is set; when both are set, oauthProfile is used. | String | ||
OAuth profile name for obtaining an access token via the OAuth 2.0 Client Credentials grant. When set, the token of the configured identity provider is sent to watsonx.data as a Bearer token instead of an IBM Cloud API key, and obtained again when it expires. Requires camel-oauth on the classpath. | String |
Message Headers
The IBM watsonx.data component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
CamelIBMWatsonxDataOperation (producer) Constant: | The operation to perform. Overrides the operation option. Enum values:
| WatsonxDataOperations | |
CamelIBMWatsonxDataCatalogName (producer) Constant: | The name of the catalog. Overrides the catalogName option. | String | |
CamelIBMWatsonxDataSchemaName (producer) Constant: | The name of the schema. Overrides the schemaName option. createSchema takes the name of the new schema from this header only. | String | |
CamelIBMWatsonxDataCustomPath (producer) Constant: | The path within the storage bucket where createSchema creates the schema. Required for createSchema. | String | |
CamelIBMWatsonxDataTableName (producer) Constant: | The name of the table. Required for getTable, deleteTable, updateTable and registerTable; getAllColumns returns only the columns of this table. There is no option for it. | String | |
CamelIBMWatsonxDataMetadataLocation (producer) Constant: | The location of the metadata file of the table that registerTable registers, for example the S3 path of an Iceberg metadata file. Required for registerTable. | String | |
CamelIBMWatsonxDataCatalogId (producer) Constant: | The ID of the catalog that registerTable registers the table in. Required for registerTable, which ignores the catalogName option. | String | |
CamelIBMWatsonxDataSchemaId (producer) Constant: | The ID of the schema that registerTable registers the table in. Required for registerTable, which ignores the schemaName option. | String | |
CamelIBMWatsonxDataEngineId (producer) Constant: | The ID of the engine. Overrides the engineId option. | String | |
CamelIBMWatsonxDataStorageDescription (producer) Constant: | The description of the storage that createStorageRegistration registers. Required for createStorageRegistration. | String | |
CamelIBMWatsonxDataStorageDisplayName (producer) Constant: | The display name of the storage that createStorageRegistration registers. Required for createStorageRegistration. | String | |
CamelIBMWatsonxDataStorageManagedBy (producer) Constant: | Who manages the storage that createStorageRegistration registers: ibm or customer. Required for createStorageRegistration. | String | |
CamelIBMWatsonxDataStorageType (producer) Constant: | The type of the storage that createStorageRegistration registers, such as ibm_cos, aws_s3, s3, minio, ibm_ceph, adls_gen1, adls_gen2, google_cs, ozone or ibm_storage_scale. Required for createStorageRegistration. | String | |
CamelIBMWatsonxDataAuthInstanceId (producer) Constant: | The ID of the watsonx.data instance, sent in the AuthInstanceId HTTP header. Overrides the authInstanceId option. | String |
Message Body
The message body at each side of the IBM watsonx.data component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Producer input |
| Only updateTable reads the body: the patch of the table, as a Map or as a JSON object in text, bytes, a stream or a file, sent as a JSON merge patch. No body, an empty patch or a body that is not a JSON object fails. The other operations take their input from the options and headers.
|
Producer output |
| The response of the IBM watsonx.data SDK, such as a CatalogCollection for listCatalogs or a Table for getTable and updateTable; converted to text, it is its JSON. The delete operations set no body.
|
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
Authentication
The component supports authentication via IBM Cloud API Key:
-
Java
-
XML
-
YAML
from("direct:start")
.to("ibm-watsonx-data:myLakehouse?apiKey=YOUR_API_KEY&serviceUrl=https://us-south.lakehouse.cloud.ibm.com/lakehouse/api/v2&operation=listCatalogs"); <route>
<from uri="direct:start"/>
<to uri="ibm-watsonx-data:myLakehouse?apiKey=YOUR_API_KEY&serviceUrl=https://us-south.lakehouse.cloud.ibm.com/lakehouse/api/v2&operation=listCatalogs"/>
</route> - route:
from:
uri: direct:start
steps:
- to:
uri: ibm-watsonx-data:myLakehouse
parameters:
apiKey: YOUR_API_KEY
serviceUrl: "https://us-south.lakehouse.cloud.ibm.com/lakehouse/api/v2"
operation: listCatalogs OAuth 2.0 Client Credentials grant is also supported when camel-oauth is on the classpath: set oauthProfile in the place of apiKey. The access token of the profile is sent to watsonx.data as a Bearer token, and asked again for every request (camel-oauth caches it until it expires), so a long-running route keeps working; the endpoint fails to start when the profile gives no token. The identity provider must issue tokens that watsonx.data accepts: IBM Cloud IAM itself does not offer the Client Credentials grant, so with IBM Cloud use apiKey. The examples read the service URL of such a deployment from the watsonx.data.service-url property.
-
Java
-
XML
-
YAML
from("direct:start")
.to("ibm-watsonx-data:myLakehouse?oauthProfile=myidp&serviceUrl={{watsonx.data.service-url}}&operation=listCatalogs"); <route>
<from uri="direct:start"/>
<to uri="ibm-watsonx-data:myLakehouse?oauthProfile=myidp&serviceUrl={{watsonx.data.service-url}}&operation=listCatalogs"/>
</route> - route:
from:
uri: direct:start
steps:
- to:
uri: ibm-watsonx-data:myLakehouse
parameters:
oauthProfile: myidp
serviceUrl: "{{watsonx.data.service-url}}"
operation: listCatalogs Operations
The component supports the following operations:
Catalog Operations
| Operation | Description |
|---|---|
| List all catalogs in the watsonx.data instance. |
| Get details of a specific catalog. Requires |
| Delete a catalog. Requires |
Schema Operations
| Operation | Description |
|---|---|
| List schemas in a catalog. Requires |
| Create a new schema. Requires |
| Delete a schema. Requires |
Table Operations
| Operation | Description |
|---|---|
| List tables in a schema. Requires |
| Get table details. Requires |
| Delete a table. Requires |
| Update table properties. Requires |
| Register an external Iceberg table. Requires |
| Get all columns for a catalog. Requires |
Engine Operations
| Operation | Description |
|---|---|
| List all Presto query engines. |
| Get details of a Presto engine. Requires |
| List all Prestissimo query engines. |
| Get details of a Prestissimo engine. Requires |
Storage Operations
| Operation | Description |
|---|---|
| List all registered storage locations. |
| Register a new storage location. Requires |
Examples
List Catalogs
-
Java
-
XML
-
YAML
from("direct:listCatalogs")
.to("ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&operation=listCatalogs")
.log("Catalogs: ${body}"); <route>
<from uri="direct:listCatalogs"/>
<to uri="ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&operation=listCatalogs"/>
<log message="Catalogs: ${body}"/>
</route> - route:
from:
uri: direct:listCatalogs
steps:
- to:
uri: ibm-watsonx-data:lakehouse
parameters:
apiKey: "{{ibm.apiKey}}"
serviceUrl: "{{ibm.watsonxdata.url}}"
operation: listCatalogs
- log:
message: "Catalogs: ${body}" List Tables in a Schema
-
Java
-
XML
-
YAML
from("direct:listTables")
.to("ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&catalogName=my-catalog&schemaName=my-schema&engineId=my-presto-engine&operation=listTables")
.log("Tables: ${body}"); <route>
<from uri="direct:listTables"/>
<to uri="ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&catalogName=my-catalog&schemaName=my-schema&engineId=my-presto-engine&operation=listTables"/>
<log message="Tables: ${body}"/>
</route> - route:
from:
uri: direct:listTables
steps:
- to:
uri: ibm-watsonx-data:lakehouse
parameters:
apiKey: "{{ibm.apiKey}}"
serviceUrl: "{{ibm.watsonxdata.url}}"
catalogName: my-catalog
schemaName: my-schema
engineId: my-presto-engine
operation: listTables
- log:
message: "Tables: ${body}" Create a Schema
-
Java
-
XML
-
YAML
from("direct:createSchema")
.setHeader("CamelIBMWatsonxDataSchemaName", constant("new_schema"))
.setHeader("CamelIBMWatsonxDataCustomPath", constant("s3a://my-bucket/new_schema"))
.to("ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&catalogName=my-catalog&engineId=my-engine&operation=createSchema")
.log("Schema created: ${body}"); <route>
<from uri="direct:createSchema"/>
<setHeader name="CamelIBMWatsonxDataSchemaName">
<constant>new_schema</constant>
</setHeader>
<setHeader name="CamelIBMWatsonxDataCustomPath">
<constant>s3a://my-bucket/new_schema</constant>
</setHeader>
<to uri="ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&catalogName=my-catalog&engineId=my-engine&operation=createSchema"/>
<log message="Schema created: ${body}"/>
</route> - route:
from:
uri: direct:createSchema
steps:
- setHeader:
name: CamelIBMWatsonxDataSchemaName
constant: new_schema
- setHeader:
name: CamelIBMWatsonxDataCustomPath
constant: "s3a://my-bucket/new_schema"
- to:
uri: ibm-watsonx-data:lakehouse
parameters:
apiKey: "{{ibm.apiKey}}"
serviceUrl: "{{ibm.watsonxdata.url}}"
catalogName: my-catalog
engineId: my-engine
operation: createSchema
- log:
message: "Schema created: ${body}" Rename a Table
The patch of the table can be a JSON object as text, for example from a file or an HTTP request:
-
Java
-
XML
-
YAML
from("direct:renameTable")
.setHeader("CamelIBMWatsonxDataTableName", constant("orders"))
.setBody(constant("{\"name\": \"orders_v2\"}"))
.to("ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&catalogName=my-catalog&schemaName=my-schema&engineId=my-presto-engine&operation=updateTable")
.log("Table updated: ${body}"); <route>
<from uri="direct:renameTable"/>
<setHeader name="CamelIBMWatsonxDataTableName">
<constant>orders</constant>
</setHeader>
<setBody>
<constant>{"name": "orders_v2"}</constant>
</setBody>
<to uri="ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}&catalogName=my-catalog&schemaName=my-schema&engineId=my-presto-engine&operation=updateTable"/>
<log message="Table updated: ${body}"/>
</route> - route:
from:
uri: direct:renameTable
steps:
- setHeader:
name: CamelIBMWatsonxDataTableName
constant: orders
- setBody:
constant: '{"name": "orders_v2"}'
- to:
uri: ibm-watsonx-data:lakehouse
parameters:
apiKey: "{{ibm.apiKey}}"
serviceUrl: "{{ibm.watsonxdata.url}}"
catalogName: my-catalog
schemaName: my-schema
engineId: my-presto-engine
operation: updateTable
- log:
message: "Table updated: ${body}" Using Dynamic Operations via Headers
from("direct:dynamic")
.setHeader("CamelIBMWatsonxDataOperation", constant(WatsonxDataOperations.listPrestoEngines))
.to("ibm-watsonx-data:lakehouse?apiKey={{ibm.apiKey}}&serviceUrl={{ibm.watsonxdata.url}}")
.log("Engines: ${body}");