ClickHouse / clickhouse-odbc

ODBC driver for ClickHouse

Home Page:https://clickhouse.tech

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CH odbc driver on TS in Kubernetes

matej-topolovec opened this issue · comments

Hi. I'm trying to install CH odbc driver on TS in Kubernetes, but I'm getting error when trying to setup data source on TS:

The driver required to connect to the data source isn't installed. Contact your Tableau Server Administrator

Tools:

TS version: 20214.21.1217.2252
CH ODBC Driver version: 1.1.10-1.el7.x86_64
CH Connection version: v1.0.0
CentOS Linux release 7.9.2009 (Core)

Setup:

  1. Build docker image following https://help.tableau.com/current/server-linux/en-us/server-in-container_setup-tool.htm
cat customer-files/setup-script
#!/bin/bash

set -ex;

yum install -y wget openssl libicu unixODBC;

# downloaded from https://github.com/ClickHouse/clickhouse-odbc/releases/download/v1.1.10.20210822/clickhouse-odbc-1.1.10-1.el7.x86_64.rpm
rpm -ivh /docker/customer-files/clickhouse-odbc-1.1.10-1.el7.x86_64.rpm;

mkdir -p /opt/tableau_connectors;

wget https://github.com/Altinity/clickhouse-tableau-connector-odbc/releases/download/v1.0.0-odbc-unicode/clickhouse_odbc_unicode.taco;

cp clickhouse_odbc_unicode.taco /opt/tableau_connectors/.;
  1. Deploy to Kubernetes & restart TS
tsm configuration set -k native_api.connect_plugins_path -v /opt/tableau_connectors
tsm pending-changes apply

After that when I click on "Clickhouse ODBC by Altinity Inc" to connect to data source I get the above error message, so I'm not sure if I'm doing something wrong.

I've checked if the driver is installed in container with:

sh-4.2$ rpm -qa | grep clickhouse
clickhouse-odbc-1.1.10-1.el7.x86_64

So I guess it is properly installed

Thanks for support!

I also believe that permissions are correctly set:

sh-4.2$ ls -la
total 28
drwxr-xr-x 2 root root  4096 Feb 23 10:41 .
drwxr-xr-x 1 root root  4096 Feb 23 10:41 ..
-rwxr-xr-x 1 root root 17928 Feb 23 10:41 clickhouse_odbc_unicode.taco
sh-4.2$ ls -la /usr/local/lib64/
total 125552
drwxr-xr-x 1 root root     4096 Feb 23 10:41 .
drwxr-xr-x 1 root root     4096 Aug 22  2021 ..
-rwxr-xr-x 1 root root 64276760 Aug 22  2021 libclickhouseodbc.so
-rwxr-xr-x 1 root root 64271632 Aug 22  2021 libclickhouseodbcw.so

To test that the ODBC driver installation is correct, try using isql to execute a simple query (after defining a driver and DSN sections as described in https://github.com/ClickHouse/clickhouse-odbc#configuration).
For resolving issues with the connector, please ask in https://github.com/Altinity/clickhouse-tableau-connector-odbc/issues

Hi @traceon thanks for input. I've managed to succeded connection to Clickhouse following this steps:

https://github.com/ClickHouse/clickhouse-odbc#configuration-unixodbc

In short, I was missing this in as a last step in setup script:

cat <<EOT >> /etc/odbcinst.ini
# Insert the content of this file into ~/.odbcinst.ini or /etc/odbcinst.ini files,
# and fix the absolute paths to libclickhouseodbc.so and libclickhouseodbcw.so files.

[ODBC Drivers]
ClickHouse ODBC Driver (ANSI)    = Installed
ClickHouse ODBC Driver (Unicode) = Installed

Trace=yes
TraceFile=/docker/user/clickhouse-odbc.log

[ClickHouse ODBC Driver (ANSI)]
Description = ODBC Driver (ANSI) for ClickHouse
Driver      = /usr/local/lib64/libclickhouseodbc.so
Setup       = /usr/local/lib64/libclickhouseodbc.so
UsageCount  = 1

[ClickHouse ODBC Driver (Unicode)]
Description = ODBC Driver (Unicode) for ClickHouse
Driver      = /usr/local/lib64/libclickhouseodbcw.so
Setup       = /usr/local/lib64/libclickhouseodbcw.so
UsageCount  = 1
EOT

cat <<EOT >> /etc/odbc.ini
# Insert the content of this file into ~/.odbc.ini or /etc/odbc.ini files.

[ODBC Data Sources]
ClickHouse DSN (ANSI)    = ClickHouse ODBC Driver (ANSI)
ClickHouse DSN (Unicode) = ClickHouse ODBC Driver (Unicode)

[ClickHouse DSN (ANSI)]
Driver      = ClickHouse ODBC Driver (ANSI)
Description = DSN (localhost) for ClickHouse ODBC Driver (ANSI)

### New all-in one way to specify connection with [optional] settings:
# Url = https://default:password@localhost:8443/query?database=default&max_result_bytes=4000000&buffer_size=3000000

# ...or minimal (will connect to port 8443 if protocol is "https://" or 8123 if it is "http://"):
# Url = https://localhost

### Old way:
# Server = localhost
# Database = default
# UID = default
# PWD = password
# Port = 8123
# Proto = http

# Timeout for http queries to ClickHouse server (default is 30 seconds)
# Timeout=60

# SSLMode:
#   allow   - ignore self-signed and bad certificates
#   require - check certificates (and fail connection if something wrong)
# SSLMode = require
# PrivateKeyFile =
# CertificateFile =
# CALocation =

DriverLog = yes
DriverLogFile = /tmp/chlickhouse-odbc-driver.log

[ClickHouse DSN (Unicode)]
Driver      = ClickHouse ODBC Driver (Unicode)
Description = DSN (localhost) for ClickHouse ODBC Driver (Unicode)
# ...
EOT