This is an automated email from the ASF dual-hosted git repository. fanng pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push: new 74f17c4afc [#6708] docs: Add documentation for the GravitinoJdbcCatalog in Flink connector (#6772) 74f17c4afc is described below commit 74f17c4afc368744b8d47527feca1a09bd7efb61 Author: yangyang zhong <35210666+hdyg...@users.noreply.github.com> AuthorDate: Wed Apr 9 07:29:39 2025 +0800 [#6708] docs: Add documentation for the GravitinoJdbcCatalog in Flink connector (#6772) ### What changes were proposed in this pull request? Add documentation for the GravitinoJdbcCatalog in Flink connector ### Why are the changes needed? close #6708 --- docs/flink-connector/flink-catalog-jdbc.md | 121 +++++++++++++++++++++++++++++ docs/flink-connector/flink-connector.md | 7 +- 2 files changed, 125 insertions(+), 3 deletions(-) diff --git a/docs/flink-connector/flink-catalog-jdbc.md b/docs/flink-connector/flink-catalog-jdbc.md new file mode 100644 index 0000000000..3d78f21131 --- /dev/null +++ b/docs/flink-connector/flink-catalog-jdbc.md @@ -0,0 +1,121 @@ +--- +title: "Flink connector jdbc catalog" +slug: /flink-connector/flink-catalog-jdbc +keyword: flink connector jdbc catalog +license: "This software is licensed under the Apache License version 2." +--- + +This document provides a comprehensive guide on configuring and using Apache Gravitino Flink connector to access the JDBC catalog managed by the Gravitino server. + +## Capabilities + +### Supported JDBC Types + +* MYSQL + +## Getting Started + +### Prerequisites + +Place the following JAR files in the lib directory of your Flink installation: + +- [flink-connector-jdbc-${flinkJdbcConnectorVersion}.jar](https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/connectors/table/jdbc/) +- [gravitino-flink-connector-runtime-1.18_2.12-${gravitino-version}.jar](https://mvnrepository.com/artifact/org.apache.gravitino/gravitino-flink-connector-runtime-1.18) +- JDBC driver + +### SQL Example + +```sql +-- Suppose jdbc_catalog is the JDBC catalog name managed by Gravitino + +USE CATALOG jdbc_catalog; + +SHOW DATABASES; +-- +------------------+ +-- | database name | +-- +------------------+ +-- | mysql | +-- +------------------+ + +CREATE DATABASE jdbc_database; +-- [INFO] Execute statement succeed. + +SHOW DATABASES; +-- +------------------+ +-- | database name | +-- +------------------+ +-- | mysql | +-- | jdbc_database | +-- +------------------+ + +USE jdbc_database; +-- [INFO] Execute statement succeed. + +SET 'execution.runtime-mode' = 'batch'; +-- [INFO] Execute statement succeed. + +SET 'sql-client.execution.result-mode' = 'tableau'; +-- [INFO] Execute statement succeed. + +USE jdbc_database; +-- [INFO] Execute statement succeed. + +SHOW TABLES; +-- Empty set + +CREATE TABLE jdbc_table_a ( + aa BIGINT NOT NULL PRIMARY KEY NOT ENFORCED, + bb BIGINT +); +-- [INFO] Execute statement succeed. + +SHOW TABLES; +-- +--------------+ +-- | table name | +-- +--------------+ +-- | jdbc_table_a | +-- +--------------+ +-- 1 row in set + +INSERT INTO jdbc_table_a VALUES(1,2); + +SELECT * FROM jdbc_table_a; +-- +----+----+ +-- | aa | bb | +-- +----+----+ +-- | 1 | 2 | +-- +----+----+ +-- 1 row in set + +INSERT INTO jdbc_table_a VALUES(2,3); +-- [INFO] Submitting SQL update statement to the cluster... +-- [INFO] SQL update statement has been successfully submitted to the cluster: +-- Job ID: bc320828d49b97b684ed9f622f1b8aca + +INSERT INTO jdbc_table_a VALUES(1,4); +-- [INFO] Submitting SQL update statement to the cluster... +-- [INFO] SQL update statement has been successfully submitted to the cluster: +-- Job ID: bc320828d49b97b684ed9f622f1b8aca + +SELECT * FROM jdbc_table_a; +-- +----+----+ +-- | aa | bb | +-- +----+----+ +-- | 1 | 4 | +-- | 2 | 3 | +-- +----+----+ +-- 2 rows in set + +``` + +## Catalog properties + +Gravitino Flink connector will transform below property names which are defined in catalog properties to Flink JDBC connector configuration. + +| Gravitino catalog property name | Flink JDBC connector configuration | Description | Since Version | +|:--------------------------------|------------------------------------|--------------------------------|------------------| +| `jdbc-url` | `base-url` | JDBC URL for MYSQL | 0.9.0-incubating | +| `username` | `username` | Username of MySQL account | 0.9.0-incubating | +| `password` | `password` | Password of the account | 0.9.0-incubating | +| `flink.bypass.default-database` | `default-database` | Default database to connect to | 0.9.0-incubating | + diff --git a/docs/flink-connector/flink-connector.md b/docs/flink-connector/flink-connector.md index e6109bb378..84067ecbeb 100644 --- a/docs/flink-connector/flink-connector.md +++ b/docs/flink-connector/flink-connector.md @@ -13,9 +13,10 @@ This capability allows users to perform federation queries, accessing data from ## Capabilities 1. Supports [Hive catalog](flink-catalog-hive.md) -1. Supports [Iceberg catalog](flink-catalog-iceberg.md) -1. Supports [Paimon catalog](flink-catalog-paimon.md) -2. Supports most DDL and DML SQLs. +2. Supports [Iceberg catalog](flink-catalog-iceberg.md) +3. Supports [Paimon catalog](flink-catalog-paimon.md) +4. Supports [Jdbc catalog](flink-catalog-jdbc.md) +5. Supports most DDL and DML SQLs. ## Requirement