Skip to content

Commit 1c6f692

Browse files
authored
Adding dbt-watsonx-presto setup and config files (#6736)
2 parents 28f5b0d + 219720a commit 1c6f692

File tree

4 files changed

+223
-1
lines changed

4 files changed

+223
-1
lines changed

website/docs/docs/community-adapters.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ Community adapters are adapter plugins contributed and maintained by members of
1515
| [MySQL](/docs/core/connect-data-platform/mysql-setup) | [RisingWave](/docs/core/connect-data-platform/risingwave-setup) | [Rockset](/docs/core/connect-data-platform/rockset-setup) |
1616
| [SingleStore](/docs/core/connect-data-platform/singlestore-setup)| [SQL Server & Azure SQL](/docs/core/connect-data-platform/mssql-setup) | [SQLite](/docs/core/connect-data-platform/sqlite-setup) |
1717
| [Starrocks](/docs/core/connect-data-platform/starrocks-setup) | [TiDB](/docs/core/connect-data-platform/tidb-setup)| [TimescaleDB](https://dbt-timescaledb.debruyn.dev/) |
18-
| [Upsolver](/docs/core/connect-data-platform/upsolver-setup) | [Vertica](/docs/core/connect-data-platform/vertica-setup) | [Yellowbrick](/docs/core/connect-data-platform/yellowbrick-setup) |
18+
| [Upsolver](/docs/core/connect-data-platform/upsolver-setup) | [Vertica](/docs/core/connect-data-platform/vertica-setup) | [Watsonx-Presto](/docs/core/connect-data-platform/watsonx-presto-setup) |
19+
| [Yellowbrick](/docs/core/connect-data-platform/yellowbrick-setup) |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
title: "IBM watsonx.data Presto setup"
3+
description: "Read this guide to learn about the IBM watsonx.data Presto setup in dbt."
4+
id: "watsonx-presto-setup"
5+
meta:
6+
maintained_by: IBM
7+
authors: Karnati Naga Vivek, Hariharan Ashokan, Biju Palliyath, Gopikrishnan Varadarajulu, Rohan Pednekar
8+
github_repo: 'IBM/dbt-watsonx-presto'
9+
pypi_package: 'dbt-watsonx-presto'
10+
min_core_version: v1.8.0
11+
cloud_support: 'Not Supported'
12+
min_supported_version: 'n/a'
13+
slack_channel_name:
14+
slack_channel_link:
15+
platform_name: IBM watsonx.data
16+
config_page: /reference/resource-configs/watsonx-presto-config
17+
---
18+
19+
The dbt-watsonx-presto adapter allows you to use dbt to transform and manage data on IBM watsonx.data Presto(Java), leveraging its distributed SQL query engine capabilities. Before proceeding, ensure you have the following:
20+
<ul>
21+
<li>An active IBM watsonx.data Presto(Java) engine with connection details (host, port, catalog, schema) in SaaS/Software.</li>
22+
<li>Authentication credentials: Username and password/apikey.</li>
23+
<li>For watsonx.data instances, SSL verification is required for secure connections. If the instance host uses HTTPS, there is no need to specify the SSL certificate parameter. However, if the instance host uses an unsecured HTTP connection, ensure you provide the path to the SSL certificate file.</li>
24+
</ul>
25+
Refer to [Configuring dbt-watsonx-presto](https://www.ibm.com/docs/en/watsonx/watsonxdata/2.1.x?topic=presto-configuration-setting-up-your-profile) for guidance on obtaining and organizing these details.
26+
27+
28+
import SetUpPages from '/snippets/_setup-pages-intro.md';
29+
30+
<SetUpPages meta={frontMatter.meta}/>
31+
32+
33+
## Connecting to IBM watsonx.data presto
34+
35+
To connect dbt with watsonx.data Presto(java), you need to configure a profile in your `profiles.yml` file located in the `.dbt/` directory of your home folder. The following is an example configuration for connecting to IBM watsonx.data SaaS and Software instances:
36+
37+
<File name='~/.dbt/profiles.yml'>
38+
39+
```yaml
40+
my_project:
41+
outputs:
42+
software:
43+
type: presto
44+
method: BasicAuth
45+
user: [user]
46+
password: [password]
47+
host: [hostname]
48+
database: [catalog name]
49+
schema: [your dbt schema]
50+
port: [port number]
51+
threads: [1 or more]
52+
ssl_verify: path/to/certificate
53+
54+
saas:
55+
type: presto
56+
method: BasicAuth
57+
user: [user]
58+
password: [api_key]
59+
host: [hostname]
60+
database: [catalog name]
61+
schema: [your dbt schema]
62+
port: [port number]
63+
threads: [1 or more]
64+
65+
target: software
66+
67+
```
68+
69+
</File>
70+
71+
## Host parameters
72+
73+
The following profile fields are required to configure watsonx.data Presto(java) connections. For IBM watsonx.data SaaS or Software instances, you can get the `hostname` and `port` details by clicking **View connect details** on the Presto(java) engine details page.
74+
75+
| Option | Required/Optional | Description | Example |
76+
| --------- | ------- | ------- | ----------- |
77+
| `method` | Required | Specifies the authentication method for secure connections. Use `BasicAuth` when connecting to IBM watsonx.data SaaS or Software instances. | `BasicAuth` |
78+
| `user` | Required | Username or email address for authentication. | `user` |
79+
| `password`| Required | Password or API key for authentication | `password` |
80+
| `host` | Required | Hostname for connecting to Presto. | `127.0.0.1` |
81+
| `database`| Required | The catalog name in your Presto instance. | `Analytics` |
82+
| `schema` | Required | The schema name within your Presto instance catalog. | `my_schema` |
83+
| `port` | Required | The port for connecting to Presto. | `443` |
84+
| `ssl_verify` | Optional (default: **true**) | Specifies the path to the SSL certificate or a boolean value. The SSL certificate path is required if the watsonx.data instance is not secure (HTTP).| `path/to/certificate` or `true` |
85+
86+
87+
### Schemas and databases
88+
When selecting the catalog and the schema, make sure the user has read and write access to both. This selection does not limit your ability to query the catalog. Instead, they serve as the default location for where tables and views are materialized. In addition, the Presto connector used in the catalog must support creating tables. This default can be changed later from within your dbt project.
89+
90+
### SSL verification
91+
- If the Presto instance uses an unsecured HTTP connection, you must set `ssl_verify` to the path of the SSL certificate file.
92+
- If the instance uses `HTTPS`, this parameter is not required and can be omitted.
93+
94+
## Additional parameters
95+
96+
The following profile fields are optional to set up. They let you configure your instance session and dbt for your connection.
97+
98+
99+
| Profile field | Description | Example |
100+
| ----------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------------ |
101+
| `threads` | How many threads dbt should use (default is `1`) | `8` |
102+
| `http_headers` | HTTP headers to send alongside requests to Presto, specified as a yaml dictionary of (header, value) pairs. | `X-Presto-Routing-Group: my-instance` |
103+
| `http_scheme` | The HTTP scheme to use for requests to (default: `http`, or `https` if `BasicAuth`) | `https` or `http` |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
title: "IBM watsonx.data Presto configurations"
3+
id: "watsonx-presto-config"
4+
---
5+
6+
## Instance requirements
7+
8+
To use IBM watsonx.data Presto(java) with `dbt-watsonx-presto` adapter, ensure the instance has an attached catalog that supports creating, renaming, altering, and dropping objects such as tables and views. The user connecting to the instance via the `dbt-watsonx-presto` adapter must have the necessary permissions for the target catalog.
9+
10+
For detailed setup instructions, including setting up watsonx.data, adding the Presto(Java) engine, configuring storages, registering data sources, and managing permissions, refer to the official IBM documentation:
11+
- watsonx.data Software Documentation: [IBM watsonx.data Software Guide](https://www.ibm.com/docs/en/watsonx/watsonxdata/2.1.x)
12+
- watsonx.data SaaS Documentation: [IBM watsonx.data SaaS Guide](https://cloud.ibm.com/docs/watsonxdata?topic=watsonxdata-getting-started)
13+
14+
15+
16+
## Session properties
17+
18+
With IBM watsonx.data SaaS/Software instance, you can [set session properties](https://prestodb.io/docs/current/sql/set-session.html) to modify the current configuration for your user session.
19+
20+
To temporarily adjust session properties for a specific dbt model or a group of models, use a [dbt hook](../../reference/resource-configs/pre-hook-post-hook). For example:
21+
22+
```sql
23+
{{
24+
config(
25+
pre_hook="set session query_max_run_time='10m'"
26+
)
27+
}}
28+
```
29+
30+
## Connector properties
31+
32+
IBM watsonx.data SaaS/Software support various connector properties to manage how your data is represented. These properties are particularly useful for file-based connectors like Hive.
33+
34+
For information on what is supported for each data source, refer to the following resources:
35+
- [watsonx.data SaaS Catalog](https://cloud.ibm.com/docs/watsonxdata?topic=watsonxdata-reg_database)
36+
- [watsonx.data Software Catalog](https://www.ibm.com/docs/en/watsonx/watsonxdata/2.1.x?topic=components-adding-data-source)
37+
38+
39+
## File format configuration
40+
41+
File-based connectors, such as Hive and Iceberg, allow customization of table materialization, data formats, and partitioning strategies in dbt models. The following examples demonstrate how to configure these options for each connector.
42+
43+
### Hive Configuration
44+
45+
Hive supports specifying file formats and partitioning strategies using the properties parameter in dbt models. The example below demonstrates how to create a partitioned table stored in Parquet format:
46+
47+
```sql
48+
{{
49+
config(
50+
materialized='table',
51+
properties={
52+
"format": "'PARQUET'", -- Specifies the file format
53+
"partitioned_by": "ARRAY['id']", -- Defines the partitioning column(s)
54+
}
55+
)
56+
}}
57+
```
58+
59+
For more details about Hive table creation and supported properties, refer to the [Hive connector documentation](https://prestodb.io/docs/current/connector/hive.html#create-a-managed-table).
60+
61+
### Iceberg Configuration
62+
63+
Iceberg supports defining file formats and advanced partitioning strategies to optimize query performance. The following example demonstrates how to create a ORC table partitioned using a bucketing strategy:
64+
65+
```sql
66+
{{
67+
config(
68+
materialized='table',
69+
properties={
70+
"format": "'ORC'", -- Specifies the file format
71+
"partitioning": "ARRAY['bucket(id, 2)']", -- Defines the partitioning strategy
72+
}
73+
)
74+
}}
75+
```
76+
For more information about Iceberg table creation and supported configurations, refer to the [Iceberg connector documentation](https://prestodb.io/docs/current/connector/iceberg.html#create-table).
77+
78+
79+
## Seeds and prepared statements
80+
The `dbt-watsonx-presto` adapter offers comprehensive support for all [watsonx.data Presto datatypes](https://www.ibm.com/support/pages/node/7157339) in seed files. To leverage this functionality, you must explicitly define the data types for each column.
81+
82+
You can configure column data types either in the dbt_project.yml file or in property files, as supported by dbt. For more details on seed configuration and best practices, refer to the [dbt seed configuration documentation](https://docs.getdbt.com/reference/seed-configs).
83+
84+
85+
## Materializations
86+
The `dbt-watsonx-presto` adapter supports both table and view materializations, allowing you to manage how your data is stored and queried in watsonx.data Presto(java).
87+
88+
For further information on configuring materializations, refer to the [dbt materializations documentation](https://docs.getdbt.com/reference/resource-configs/materialized).
89+
90+
### Table
91+
92+
The `dbt-watsonx-presto` adapter enables you to create and update tables through table materialization, making it easier to work with data in watsonx.data Presto.
93+
94+
#### Recommendations
95+
- **Check Permissions:** Ensure that the necessary permissions for table creation are enabled in the catalog or schema.
96+
- **Check Connector Documentation:** Review watsonx.data Presto [sql statement support](https://www.ibm.com/support/pages/node/7157339) to ensure it supports table creation and modification.
97+
98+
#### Limitations with some connectors
99+
Certain watsonx.data Presto connectors, particularly read-only ones or those with restricted permissions, do not allow creating or modifying tables. If you attempt to use table materialization with these connectors, you may encounter an error like:
100+
101+
```sh
102+
PrestoUserError(type=USER_ERROR, name=NOT_SUPPORTED, message="This connector does not support creating tables with data", query_id=20241206_071536_00026_am48r)
103+
```
104+
105+
### View
106+
107+
The `dbt-watsonx-presto` adapter automatically creates views by default, as views are the standard materialization in dbt. If no materialization is explicitly specified, dbt will create a view in watsonx.data Presto.
108+
109+
To confirm whether your connector supports view creation, refer to the watsonx.data [sql statement support](https://www.ibm.com/support/pages/node/7157339).
110+
111+
112+
## Unsupported features
113+
The following features are not supported by the `dbt-watsonx-presto` adapter
114+
- Incremental Materialization
115+
- Materialized Views
116+
- Snapshots

website/sidebars.js

+2
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ const sidebarSettings = {
253253
"docs/core/connect-data-platform/tidb-setup",
254254
"docs/core/connect-data-platform/upsolver-setup",
255255
"docs/core/connect-data-platform/vertica-setup",
256+
"docs/core/connect-data-platform/watsonx-presto-setup",
256257
"docs/core/connect-data-platform/yellowbrick-setup",
257258
],
258259
},
@@ -899,6 +900,7 @@ const sidebarSettings = {
899900
"reference/resource-configs/teradata-configs",
900901
"reference/resource-configs/upsolver-configs",
901902
"reference/resource-configs/vertica-configs",
903+
"reference/resource-configs/watsonx-presto-config",
902904
"reference/resource-configs/yellowbrick-configs",
903905
],
904906
},

0 commit comments

Comments
 (0)