> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 使用 ClickHouse 官方连接器时的 Tableau 连接技巧。

# 连接提示

export const ClickHouseSupportedBadge = () => {
  return <div className="ClickHouseSupportedBadge">
            <div className="ClickHouseSupportedIcon">
                <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M1.30762 1.39073C1.30762 1.3103 1.37465 1.22986 1.46849 1.22986H2.64824C2.72868 1.22986 2.80912 1.29689 2.80912 1.39073V14.4886C2.80912 14.5691 2.74209 14.6495 2.64824 14.6495H1.46849C1.38805 14.6495 1.30762 14.5825 1.30762 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M4.2832 1.39073C4.2832 1.3103 4.35023 1.22986 4.44408 1.22986H5.62383C5.70427 1.22986 5.7847 1.29689 5.7847 1.39073V14.4886C5.7847 14.5691 5.71767 14.6495 5.62383 14.6495H4.44408C4.36364 14.6495 4.2832 14.5825 4.2832 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M7.25977 1.39073C7.25977 1.3103 7.3268 1.22986 7.42064 1.22986H8.60039C8.68083 1.22986 8.76127 1.29689 8.76127 1.39073V14.4886C8.76127 14.5691 8.69423 14.6495 8.60039 14.6495H7.42064C7.3402 14.6495 7.25977 14.5825 7.25977 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M10.2354 1.39073C10.2354 1.3103 10.3024 1.22986 10.3962 1.22986H11.576C11.6564 1.22986 11.7369 1.29689 11.7369 1.39073V14.4886C11.7369 14.5691 11.6698 14.6495 11.576 14.6495H10.3962C10.3158 14.6495 10.2354 14.5825 10.2354 14.4886V1.39073Z" fill="currentColor" />
                    <path d="M13.2256 6.6057C13.2256 6.52526 13.2926 6.44482 13.3865 6.44482H14.5662C14.6466 6.44482 14.7271 6.51186 14.7271 6.6057V9.27354C14.7271 9.35398 14.6601 9.43442 14.5662 9.43442H13.3865C13.306 9.43442 13.2256 9.36739 13.2256 9.27354V6.6057Z" fill="currentColor" />
                </svg>
            </div>
            支持 ClickHouse
        </div>;
};

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

<div id="initial-sql-tab">
  ## 初始 SQL 选项卡
</div>

如果在高级选项卡中启用了 *设置会话 ID* 复选框 (默认启用) ，则可以使用[设置](/zh/reference/settings/session-settings)设置会话级别的配置

```text theme={null}
SET my_setting=value;
```

<div id="advanced-tab">
  ## 高级选项卡
</div>

在 99% 的情况下，你都不需要用到高级选项卡；而在剩下的 1% 场景中，可以使用以下设置：

* **自定义连接参数**。默认已指定 `socket_timeout`；如果某些提取任务的更新时间非常长，可能需要调整此参数。该参数的值以毫秒为单位。其余参数可在[此处](https://github.com/ClickHouse/clickhouse-jdbc/blob/master/clickhouse-client/src/main/java/com/clickhouse/client/config/ClickHouseClientOption.java)查看，请以逗号分隔后添加到此字段中

* **JDBC 驱动 custom\_http\_params**。此字段允许你通过向[驱动的 `custom_http_params` 参数](https://github.com/ClickHouse/clickhouse-jdbc#configuration)传值，将某些参数附加到 ClickHouse 连接字符串中。例如，启用 *设置会话 ID* 复选框后，`session_id` 就是通过这种方式指定的

* **JDBC 驱动 `typeMappings`**。此字段允许你[传递从 ClickHouse 数据类型到 JDBC 驱动所使用的 Java 数据类型的映射列表](https://github.com/ClickHouse/clickhouse-jdbc#configuration)。连接器会借助此参数自动将大整数显示为字符串；你也可以通过传入自己的映射集来更改这一行为 * (我也不知道为什么) *，用法如下
  ```text theme={null}
  UInt256=java.lang.Double,Int256=java.lang.Double
  ```
  有关映射的更多信息，请参阅对应章节

* **JDBC 驱动 URL 参数**。你可以在此字段中传递其余的[驱动参数](https://github.com/ClickHouse/clickhouse-jdbc#configuration)，例如 `jdbcCompliance`。请注意，参数值必须采用 URL Encoded 格式传递；如果在此字段以及高级选项卡前面的字段中同时传递 `custom_http_params` 或 `typeMappings`，则高级选项卡中前两个字段的值优先级更高

* **设置会话 ID** 复选框。此选项用于在 初始 SQL 选项卡中设置会话级设置，并会生成一个包含时间戳和伪随机数的 `session_id`，格式为 `"tableau-jdbc-connector-*{timestamp}*-*{number}*"`

<div id="limited-support-for-uint64-int128-uint256-data-types">
  ## 对 UInt64、Int128、(U)Int256 数据类型的支持有限
</div>

默认情况下，驱动程序会将 *UInt64、Int128、(U)Int256* 类型的字段显示为字符串，**但这只是显示，不是转换**。这意味着，当你尝试编写下一个计算字段时，会报错

```text theme={null}
LEFT([myUInt256], 2) // 错误！
```

若要像处理字符串一样处理大型 Integer 字段，必须显式使用 STR() 函数将该字段包裹起来

```text theme={null}
LEFT(STR([myUInt256]), 2) // 运行正常！
```

不过，这类字段最常见的用途，是统计唯一值的数量\* (例如 Yandex.Metrica 中的 Watch ID、Visit ID 等 ID) *，或作为指定可视化细粒度的*维度\*，因此效果很好。

```text theme={null}
COUNTD([myUInt256]) // 同样运行正常！
```

使用包含 UInt64 字段的表的数据预览 (查看数据) 时，现在不会再报错。
