# Incorrect datasource schema generated

**URL:** <https://community.dremio.com/t/incorrect-datasource-schema-generated/4906>\
**Category:** Uncategorized\
**Created:** [January 17, 2020, 10:36am UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906 "2020-01-17T10:36:31Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![stifstyle](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stifstyle](https://community.dremio.com/u/stifstyle)\
**Post date:** [January 17, 2020, 10:36am UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/1 "2020-01-17T10:36:31Z")

</div>

I’m trying to create Clickhouse connector using instructions from [https://www.dremio.com/tutorials/how-to-create-an-arp-connector/](https://www.dremio.com/tutorials/how-to-create-an-arp-connector/) and [https://github.com/ClickHouse/clickhouse-jdbc](https://github.com/ClickHouse/clickhouse-jdbc) driver. I’ve managed to connect to my Clickhouse server with Dremio, but now am facing issues with wrong schema generated. Clickhouse has only one level of namespace (the database name), and the schema in Dremio is generated with multiple levels (“default” folder / database folders / tables). So when I try to query any table it sends request "select … from “default”.“database”.“table” instead of "select … from “database”.“table” which causes query to fail. Is there some way I could modify schema structure or query structure (assuming I’m not quite familiar with Java)?

---

<div class="post-metadata">

**Author:** ![mdq417](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@mdq417](https://community.dremio.com/u/mdq417)\
**Post date:** [March 18, 2020, 11:06am UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/2 "2020-03-18T11:06:54Z")

</div>

Hi,  
Is there any update on the connector? Have you fix the problem?

---

<div class="post-metadata">

**Author:** ![dacopan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/dacopan/32/4289_2.png) [@dacopan](https://community.dremio.com/u/dacopan)\
**Post date:** [March 18, 2020, 3:40pm UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/3 "2020-03-18T15:40:00Z")

</div>

are you @stifstyle and @mdq417 developing a custom connector? can you share your code of ARP yml and java config?  
The issue that you have could be by a wrong connector code.  
I’ve developed with success a custom connector for Ibmdb2 and for aws athena

---

<div class="post-metadata">

**Author:** ![stifstyle](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stifstyle](https://community.dremio.com/u/stifstyle)\
**Post date:** [March 18, 2020, 6:58pm UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/4 "2020-03-18T18:58:09Z")

</div>

Yes, I made it work somehow with official Clickhouse JDBC ([https://github.com/ClickHouse/clickhouse-jdbc](https://github.com/ClickHouse/clickhouse-jdbc)). Although I had to make some changes to make it work with Dremio:

1. Used newer versions of com.fasterxml.jackson.core (2.9.9) and com.google.guava (20.0) ([https://pastebin.com/Y4LJeeXC](https://pastebin.com/Y4LJeeXC))
2. Modified file /src/main/java/ru/yandex/clickhouse/ClickHouseDatabaseMetadata.java to make it ignore extra level of namespace. ([https://pastebin.com/bHdUkVz0](https://pastebin.com/bHdUkVz0))  
Then built jar with dependencies.

Considering Dremio ARP connector, I used the following ARP yml and Java config:

1. clickhouse-arp.yaml: [https://pastebin.com/4xcmSpz4](https://pastebin.com/4xcmSpz4) (definitely requires changes to improve performance and optimize certain queries, but it works)
2. ClickhouseConf.java: [https://pastebin.com/W3NyBc8Q](https://pastebin.com/W3NyBc8Q)

---

<div class="post-metadata">

**Author:** ![mdq417](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@mdq417](https://community.dremio.com/u/mdq417)\
**Post date:** [March 19, 2020, 9:19am UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/5 "2020-03-19T09:19:19Z")

</div>

Thank you! I am new to Dremio and not a developer. I do not know how to build the connecter with the files you kindly provided.

Can you share the jar file that need to be put in the “[software location]/dremio/jars” folder that mentioned in the installation guide below?

> [https://www.dremio.com/hub/](https://www.dremio.com/hub/)
> 
> To install a selected connector, simply download the source connector files and the vendor’s respective JDBC driver and install into Dremio with the following steps:
> 
> 1. Select the connector of interest
> 
> 2. Click the “Download Connector” link to download the connector file
> 
> 3. Copy the connector file to the “[software location]/dremio/jars” folder in each Dremio node
> 
> 4. Click the “Download JDBC” link to go to the database vendor’s website
> 
> 5. Download the JDBC driver for the given source from the vendor’s web site
> 
> 6. Copy the JDBC driver to the “[software location]/dremio/jars/3rdparty” folder in each Dremio node
> 
> 7. Restart Dremio
> 
> After restarting, the community connector will appear in the list of available sources.

---

<div class="post-metadata">

**Author:** ![dacopan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/dacopan/32/4289_2.png) [@dacopan](https://community.dremio.com/u/dacopan)\
**Post date:** [March 20, 2020, 10:40pm UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/6 "2020-03-20T22:40:39Z")

</div>

you dont need to be expert developer to build a custom conenctor, but yo need the correct tools for it, JDK, java project, and know how build…

the jar mentioned in the guide is the JAR that you must build of your custom connector using JDK

plase can you share what are you trying do?

---

<div class="post-metadata">

**Author:** ![mdq417](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@mdq417](https://community.dremio.com/u/mdq417)\
**Post date:** [March 25, 2020, 10:44am UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/7 "2020-03-25T10:44:47Z")

</div>

I do not know how to build…  
I try to connect to Clickhouse using Dremio and there is no connector available. That is how I found this post.

---

<div class="post-metadata">

**Author:** ![mdq417](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@mdq417](https://community.dremio.com/u/mdq417)\
**Post date:** [May 12, 2020, 9:26am UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/8 "2020-05-12T09:26:54Z")

</div>

Can you share the jar file of the final connecter? Thank you!

---

<div class="post-metadata">

**Author:** ![balaji.ramaswamy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/balaji.ramaswamy/32/843_2.png) [@balaji.ramaswamy](https://community.dremio.com/u/balaji.ramaswamy)\
**Post date:** [May 14, 2020, 6:56am UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/9 "2020-05-14T06:56:53Z")

</div>

@mdq417

The jar file would be different for different connectors, see below link to get started

> **[Dremio Hub](https://www.dremio.com/hub/)**
>
> Dremio Hub provides community-supported connectors.

---

<div class="post-metadata">

**Author:** ![mdq417](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@mdq417](https://community.dremio.com/u/mdq417)\
**Post date:** [May 21, 2020, 10:36am UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/10 "2020-05-21T10:36:41Z")

</div>

I have read the link. The connector I need is for Clickhouse same as @stifstyle.

---

<div class="post-metadata">

**Author:** ![stifstyle](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@stifstyle](https://community.dremio.com/u/stifstyle)\
**Post date:** [May 21, 2020, 12:59pm UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/11 "2020-05-21T12:59:01Z")

</div>

Try these files : [https://transfer.sh/f02JK/dremio\_clickhouse.zip](https://transfer.sh/f02JK/dremio_clickhouse.zip)  
But I’m not sure if it would work.

clickhouse-jdbc-0.2.3-jar-with-dependencies.jar - goes into /\<path\_to\_dremio\>/jars/3rdparty  
dremio-clickhouse-plugin-4.1.3-202001022113020736-53142377.jar - into /\<path\_to\_dremio\>/jars

I used it with Dremio version 4.1.3. And this connector I made was still a bit buggy (due to config), had no time to fix some of the strange issues I faced.

---

<div class="post-metadata">

**Author:** ![dmitrij.a](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@dmitrij.a](https://community.dremio.com/u/dmitrij.a)\
**Post date:** [March 11, 2021, 6:54am UTC](https://community.dremio.com/t/incorrect-datasource-schema-generated/4906/12 "2021-03-11T06:54:26Z")

</div>

@stifstyle what’s the status of the your connector now? Were you able to make it work good? Thanks in advance
