Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: External Table ( for ClickHouse ) #546

Merged
merged 26 commits into from
Feb 3, 2024

Conversation

zliang-min
Copy link
Collaborator

PR checklist:

  • Did you run ClangFormat ?
  • Did you separate headers to a different section in existing community code base ?
  • Did you surround proton: starts/ends for new code in existing community code base ?

Please write user-readable short description of the changes:

New feature for creating External Tabels to connect to non-streaming data sources. In this first implementation, a ClickHouse External Table has been implemented.

Examples:

To create an external table:

CREATE EXTERNAL TABLE my_first_table SETTINGS type='clickhouse',address='my_clickhouse_server:9000',database='my_database',table='my_table',user='my_user',passowrd='my_password'

External tables do not accept the column list, it fetches its table structure from the remote data source. After the table is created, one can use DESCRIBE my_table to see its structure.

Then, it can be queried just like any tables/streams:

-- read data
SELECT * FROM my_external_table;

-- write data
INSERT INTO my_external_table VALUES (...);

-- use it as a materialized view target
CREATE MATERIALIZED VIEW some_view INTO my_external_table AS SELECT ...;

To drop an external table:

DROP EXTERNAL TABLE my_table

@zliang-min zliang-min self-assigned this Feb 1, 2024
@jovezhong
Copy link
Contributor

Hi @zliang-min , please test the behavior of connecting to a view or materialized view in ClickHouse.

Probably Proton can still read it but cannot write to it. If the user creates an external table connecting to a ClickHouse view, then try to use it as target for Proton Materialized view. The materialized view DDL should fail, instead of creation is done but no result while MV is running

@zliang-min
Copy link
Collaborator Author

zliang-min commented Feb 3, 2024

Hi @zliang-min , please test the behavior of connecting to a view or materialized view in ClickHouse.

Probably Proton can still read it but cannot write to it. If the user creates an external table connecting to a ClickHouse view, then try to use it as target for Proton Materialized view. The materialized view DDL should fail, instead of creation is done but no result while MV is running

Checked, it works for views and materialized views (read-only of course).

@zliang-min zliang-min merged commit ec89390 into develop Feb 3, 2024
21 checks passed
@zliang-min zliang-min deleted the feature/external-table branch February 3, 2024 18:11
@jovezhong
Copy link
Contributor

(Jove Github Bot) added it to the current sprint.

@jovezhong
Copy link
Contributor

(Jove Github Bot) moved this ticket out of the GitHub project(up to 1200 tickets for one project).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants