Skip to content

Commit

Permalink
add sensitive support for password
Browse files Browse the repository at this point in the history
add sensitive support for password

add sensitive support for password

add sensitive support for password

add sensitive support for password

add sensitive support for password
  • Loading branch information
jeff-zou committed Oct 25, 2023
1 parent 9ffecdb commit 5b458b8
Show file tree
Hide file tree
Showing 13 changed files with 904 additions and 117 deletions.
62 changes: 42 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
### Instructions for use:

After executing mvn package -DskipTests on the command line, import the generated package
flink-catalog-in-jdbc-1.0.jar into flink lib, no other settings are required.
After executing mvn package on the command line, import the generated package
flink-catalog-in-jdbc-1.8.jar into flink(support flink 1.16) lib, no other settings are required.

Development environment engineering direct reference:

```
<dependency>
<groupId>io.github.jeff-zou</groupId>
<artifactId>flink-catalog-in-jdbc</artifactId>
<version>1.6</version>
<version>1.8</version>
</dependency>
```

if your flink's version is 1.15:
```
<dependency>
<groupId>io.github.jeff-zou</groupId>
<artifactId>flink-catalog-in-jdbc</artifactId>
<version>1.8-flink-1.15</version>
</dependency>
```

Expand All @@ -20,40 +29,46 @@ Development environment engineering direct reference:
CREATE TABLE `flink_catalog_databases` (
`comment` varchar(100) DEFAULT NULL COMMENT '1',
`properties` varchar(100) DEFAULT NULL,
`database_name` varchar(100) DEFAULT NULL,
UNIQUE KEY `flink_catalog_databases_un` (`database_name`)
`database_name` varchar(100) NOT NULL,
`catalog_name` varchar(100) NOT NULL,
PRIMARY KEY (`database_name`,`catalog_name`)
) ;
CREATE TABLE `flink_catalog_tables` (
`script` varchar(5000) DEFAULT NULL COMMENT '1',
`object_name` varchar(100) DEFAULT NULL,
`database_name` varchar(100) DEFAULT NULL,
`object_name` varchar(100) NOT NULL,
`database_name` varchar(100) NOT NULL,
`kind` varchar(20) DEFAULT NULL,
`comment` varchar(200) DEFAULT NULL,
UNIQUE KEY `flink_catalog_databases_un` (`database_name`,`object_name`)
);
`password` varchar(200) DEFAULT NULL,
`catalog_name` varchar(100) NOT NULL,
PRIMARY KEY (`catalog_name`,`database_name`,`object_name`)
) ;
CREATE TABLE `flink_catalog_functions` (
`database_name` varchar(100) DEFAULT NULL,
`object_name` varchar(100) DEFAULT NULL,
`database_name` varchar(100) NOT NULL,
`object_name` varchar(100) NOT NULL,
`class_name` varchar(200) DEFAULT NULL COMMENT '1',
`function_language` varchar(20) DEFAULT NULL,
UNIQUE KEY `flink_catalog_functions_un` (`database_name`,`object_name`)
`comment` varchar(500) DEFAULT NULL,
`catalog_name` varchar(100) NOT NULL,
PRIMARY KEY (`database_name`,`object_name`,`catalog_name`)
) ;
CREATE TABLE `flink_catalog_columns` (
`database_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`object_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`column_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`column_type` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`column_comment` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
UNIQUE KEY `flink_catalog_columns_un` (`database_name`,`object_name`,`column_name`)
)
`database_name` varchar(100) NOT NULL,
`object_name` varchar(100) NOT NULL,
`column_name` varchar(50) NOT NULL,
`column_type` varchar(100) DEFAULT NULL,
`column_comment` varchar(200) DEFAULT NULL,
`catalog_name` varchar(100) NOT NULL,
PRIMARY KEY (`database_name`,`object_name`,`catalog_name`,`column_name`)
) ;
```

### usage
```
create catalog my_catalog with ( 'type'='generic_in_jdbc', 'default-database'='test', 'username'='test', 'password'='****',
create catalog my_catalog with ( 'type'='generic_in_jdbc', 'default-database'='test', 'username'='test', 'password'='****','secret.key'='****'
'url'='jdbc:mysql://*****:3306/test_database?useUnicode=true&characterEncoding=utf8&autoReconnect=true');
use catalog my_catalog;
Expand All @@ -78,3 +93,10 @@ CREATE TABLE if not exists `test` (
show create table test;
```
Parameter Description</br>

| Parameter | Description |
|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| username | the username of DB |
| password | the password of DB |
| secret.key | The key used for encrypting the password which in the metadata, it should not be modified after the data is saved, otherwise the metadata cannot be restored. |
188 changes: 177 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.jeff-zou</groupId>
<artifactId>flink-catalog-in-jdbc</artifactId>
<version>1.6</version>
<version>1.8</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand All @@ -16,8 +16,61 @@
<otj-pg-embedded.version>0.13.4</otj-pg-embedded.version>
<flink.version>1.16.1</flink.version>
<scala.binary.version>2.12</scala.binary.version>

<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<!--项目编码-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--插件版本-->
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-release-plugin.version>3.0.0-M1</maven-release-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>

<maven-deploy-plugin.version>3.0.0-M2</maven-deploy-plugin.version>
</properties>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<description>the catalog for flink which store in jdbc.</description>
<url>https://github.com/jeff-zou/flink-catalog-in-jdbc.git</url>
<name>flink-catalog-in-jdbc</name>

<scm>
<url>https://github.com/jeff-zou/flink-catalog-in-jdbc</url>
<connection>scm:git:[email protected]/jeff-zou/flink-catalog-in-jdbc.git</connection>
<developerConnection>scm:git:https://github.com/jeff-zou/flink-catalog-in-jdbc.git</developerConnection>
<tag>HEAD</tag>
</scm>

<developers>
<developer>
<id>jeff</id>
<name>jeff-zou</name>
<email>[email protected]</email>
<url>https://github.com/jeff-zou</url>
<timezone>+8</timezone>
</developer>
</developers>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<dependencies>
<!-- Table ecosystem -->

Expand Down Expand Up @@ -107,22 +160,135 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
<scope>test</scope>
</dependency>
</dependencies>


<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
<skip>true</skip>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>



<profiles>
<!--release-->
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin>
<!-- Source -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<show>package</show>
<tags>
<tag>
<name>date</name>
</tag>
</tags>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<doclint>none</doclint>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>ossrh</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<keyname>D8569E743AC67440</keyname>
<passphraseServerId>D8569E743AC67440</passphraseServerId>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>sonatype-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>sonatype-release</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</profile>
</profiles>
</project>
Loading

0 comments on commit 5b458b8

Please sign in to comment.