|
| 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 |
0 commit comments