diff --git a/docs/zh-cn/_sidebar.md b/docs/zh-cn/_sidebar.md index 60b607c..2132b36 100644 --- a/docs/zh-cn/_sidebar.md +++ b/docs/zh-cn/_sidebar.md @@ -33,17 +33,11 @@ * [渲染导入导出](zh-cn/command/impexp.md) * 逆向 * [逆向建模](zh-cn/reverse/model.md) - * [逆向生成指标](zh-cn/reverse/indicator.md) * 发布 * [模型发布](zh-cn/publish/model.md) * DDL转换 * [总览](zh-cn/transformer/guide.md) * [建表SDK](zh-cn/transformer/table.md) - * [MaxCompute](zh-cn/transformer/maxcompute.md) - * [Hive](zh-cn/transformer/hive.md) - * [Hologres](zh-cn/transformer/hologres.md) - * [Mysql](zh-cn/transformer/mysql.md) - * [Oracle](zh-cn/transformer/oracle.md) * [其他](zh-cn/transformer/other.md) * [比较](zh-cn/transformer/compare.md) * JDBC diff --git a/docs/zh-cn/jdbc/cli.md b/docs/zh-cn/jdbc/cli.md index e69de29..0c97629 100644 --- a/docs/zh-cn/jdbc/cli.md +++ b/docs/zh-cn/jdbc/cli.md @@ -0,0 +1,43 @@ +# Cli + +FML支持通过Cli(command line interface)访问建模引擎。 + + +## 安装 + +下载fast-modeling-language源码,在根目录下执行 +```shell +mvn clean install -Dmaven.test.skip +``` + +``` +cd fastmodel-driver/fastmodel-driver-cli/target/zip +``` + +## 配置 + +``` +unzip fastmodel-driver-cli-${version}-distribution.zip +``` + +```shell +fastmodel.url=localhost:18080 +fastmodel.ssl=false +fastmodel.database= +fastmodel.password= +fastmodel.user= +``` + + +## 启动 + +```shell +./start.sh +``` + + + + + + + diff --git a/docs/zh-cn/jdbc/guide.md b/docs/zh-cn/jdbc/guide.md index e69de29..863e4fb 100644 --- a/docs/zh-cn/jdbc/guide.md +++ b/docs/zh-cn/jdbc/guide.md @@ -0,0 +1,59 @@ +# JDBC + +FML提供了Driver支持通过JDBC Driver的方式来进行连接使用,主要使用的过程如下: +```plantuml +@startuml +autonumber +actor User +User -> JDBC : 执行FML语句 + +JDBC -> 建模引擎 : 通过RPC提交FML语句和上下文信息 + +建模引擎 -> FMLSDK : 将FML语句通过SDK转换为FML模型 + +建模引擎 -> User : 返回操作结果 + +@enduml +``` + + + +# 使用方式 + +## maven引用 + +```xml + + com.aliyun.fastmodel + fastmodel-driver-client + ${最新版本} + +``` + + +## Demo + +```java + String url = "jdbc:fastmodel://localhost:8082/jdbc"; + + static { + try { + Class.forName("com.aliyun.fastmodel.driver.client.FastModelEngineDriver"); + } catch (ClassNotFoundException e) { + //throw e + } + } + + @Test + public void testConnection() throws SQLException { + Properties properties = getProperties(); + Connection connection = DriverManager.getConnection(url, properties); + Statement statement = connection.createStatement(); + ResultSet resultSet = statement.executeQuery("show tables;"); + assertTrue(resultSet.next()); + String string = resultSet.getString(1); + assertEquals(string, "abc"); + assertFalse(resultSet.next()); + connection.close(); + } +``` \ No newline at end of file diff --git a/docs/zh-cn/transformer/hive.md b/docs/zh-cn/transformer/hive.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zh-cn/transformer/mysql.md b/docs/zh-cn/transformer/mysql.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zh-cn/transformer/oracle.md b/docs/zh-cn/transformer/oracle.md deleted file mode 100644 index e69de29..0000000 diff --git a/docs/zh-cn/transformer/table.md b/docs/zh-cn/transformer/table.md index d96e3f4..3f85d81 100644 --- a/docs/zh-cn/transformer/table.md +++ b/docs/zh-cn/transformer/table.md @@ -26,11 +26,11 @@ import static org.junit.Assert.assertEquals; public class Test { @Test - public void testMaxCompute() { + public void testHive() { CodeGenerator codeGenerator = new DefaultCodeGenerator(); Table table = getTable("c1", "c1", 1000L); TableConfig config = TableConfig.builder() - .dialectMeta(DialectMeta.DEFAULT_MAX_COMPUTE) //这里根据目标引擎选择 + .dialectMeta(DialectMeta.DEFAULT_HIVE) //这里根据目标引擎选择 .caseSensitive(false) .build(); DdlGeneratorModelRequest request = DdlGeneratorModelRequest.builder() @@ -42,8 +42,7 @@ public class Test { assertEquals(dialectNodes.stream().map(DialectNode::getNode).collect(Collectors.joining(";\n")), "CREATE TABLE IF NOT EXISTS a\n" + "(\n" + " c1 STRING COMMENT 'comment'\n" - + ")\n" - + "LIFECYCLE 1"); + + ")\n"); } private Table getTable(String id, String name, long lifeCycleSeconds) { diff --git a/fastmodel-driver/fastmodel-driver-cli/src/main/resources/fml_config.properties b/fastmodel-driver/fastmodel-driver-cli/src/main/resources/fml_config.properties index 55b225d..c65f95f 100644 --- a/fastmodel-driver/fastmodel-driver-cli/src/main/resources/fml_config.properties +++ b/fastmodel-driver/fastmodel-driver-cli/src/main/resources/fml_config.properties @@ -13,21 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # - -#model-engine的地址,必填 fastmodel.url=localhost:18080 -#是否使用https,true待办https, 必填,默认为true,如果是http接口,设置为false fastmodel.ssl=false -#使用的业务板块,必填 -fastmodel.database=14255 -#租户的token,必填 -fastmodel.token=96063edcb9f5d80926d14f70e491ff1b73463f70ddc2773a843bc98e4e4ca36f -#租户的baseKey,必填,由系统分发 -fastmodel.baseKey=base_dp -#必填,弹内是用户工号,需要补0操作 -fastmodel.user=037888 -#必填,名字 -fastmodel.showName=家娃 -#路径 -#租户,弹内,默认就是1 -#fastmodel.tenantId=1 \ No newline at end of file +fastmodel.database=database +fastmodel.password=password +fastmodel.user=user