Skip to content

Commit

Permalink
docs: improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Willam2004 committed Oct 7, 2023
1 parent 8a050c7 commit 4efd057
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 26 deletions.
6 changes: 0 additions & 6 deletions docs/zh-cn/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 43 additions & 0 deletions docs/zh-cn/jdbc/cli.md
Original file line number Diff line number Diff line change
@@ -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
```







59 changes: 59 additions & 0 deletions docs/zh-cn/jdbc/guide.md
Original file line number Diff line number Diff line change
@@ -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
<dependency>
<groupId>com.aliyun.fastmodel</groupId>
<artifactId>fastmodel-driver-client</artifactId>
<version>${最新版本}</version>
</dependency>
```


## 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();
}
```
Empty file removed docs/zh-cn/transformer/hive.md
Empty file.
Empty file removed docs/zh-cn/transformer/mysql.md
Empty file.
Empty file removed docs/zh-cn/transformer/oracle.md
Empty file.
7 changes: 3 additions & 4 deletions docs/zh-cn/transformer/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
fastmodel.database=database
fastmodel.password=password
fastmodel.user=user

0 comments on commit 4efd057

Please sign in to comment.