Inasa Xia
Inasa Xia

Reputation: 501

Clickhouse create jdbc engine table?

CREATE TABLE jdbc_table 
ENGINE = JDBC('jdbc:mysql://192.168.10.16:4307/?user=root&password=root', 'test', 'test')

this statement gets error

Syntax error: failed at position 114 (end of query):

CREATE TABLE jdbc_table ENGINE = JDBC('jdbc:mysql://192.168.10.16:4307/?user=root&password=root', 'test', 'test')

Expected one of: AS, SETTINGS, TTL, PARTITION BY, PRIMARY KEY, ORDER BY, SAMPLE BY

I don't know why.

Upvotes: 2

Views: 1322

Answers (1)

Denny Crane
Denny Crane

Reputation: 13310

Documentation is incorrect. Create table needs a columns list (e.g. (A String, B UInt32)).

create table jdbc.category engine 
= JDBC('datasource://postgresql', 'public', 'category')
as select * from jdbc('datasource://postgresql', 'public', 'category');

or

create table jdbc.category(A String, B UInt32) 
engine = JDBC('datasource://postgresql', 'public', 'category')

Upvotes: 3

Related Questions