Skip to content

Commit 46da29d

Browse files
leonardBangclaude
andcommitted
[FLINK-39252][pipeline-connector/sqlserver] Polish docs and add SQL Server pipeline YAML e2e test
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent fc63825 commit 46da29d

12 files changed

Lines changed: 617 additions & 31 deletions

File tree

docs/content.zh/docs/connectors/pipeline-connectors/sqlserver.md

Lines changed: 160 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ SQL Server CDC Pipeline 连接器支持从 SQL Server 数据库读取快照数
3333
- SQL Server Agent 正在运行。
3434
- 已为数据库和需要捕获的表开启 Change Data Capture。
3535
- 配置的 SQL Server 用户可以连接服务器并读取被捕获的表。
36-
- 当前连接器的 `tables` 配置只支持一个字面量数据库名;schema 和 table 部分可以使用正则表达式
36+
- 当前连接器的 `tables` 配置中,数据库只支持单个固定库名,schema 和 table 支持正则表达式匹配多个
3737

3838
为数据库和表启用 CDC:
3939

@@ -70,9 +70,9 @@ source:
7070
name: SQL Server Source
7171
hostname: 127.0.0.1
7272
port: 1433
73-
username: debezium
74-
password: password
75-
# 所有匹配的表必须使用同一个字面量数据库名
73+
username: root
74+
password: 123456
75+
# 数据库只支持单个固定库名,schema 和 table 支持正则匹配多个
7676
tables: inventory.dbo.\.*
7777
schema-change.enabled: true
7878

@@ -81,7 +81,7 @@ sink:
8181
name: Doris Sink
8282
fenodes: 127.0.0.1:8030
8383
username: root
84-
password: password
84+
password: 123456
8585

8686
pipeline:
8787
name: SQL Server to Doris Pipeline
@@ -135,15 +135,15 @@ pipeline:
135135
<td>required</td>
136136
<td style="word-wrap: break-word;">(none)</td>
137137
<td>String</td>
138-
<td>需要监控的 SQL Server 表名。schema 和 table 名支持正则表达式。所有表匹配规则必须使用同一个字面量数据库名;不支持数据库级别正则表达式或跨数据库匹配。点号(.)会被视为 database、schema 和 table 名的分隔符。如果需要在正则表达式中使用点号(.)匹配任意字符,必须使用反斜杠转义。<br>
138+
<td>需要监控的 SQL Server 表名。database只支持单个固定库名,schema 和 table 支持正则表达式匹配多个;不支持数据库级别正则表达式或跨数据库匹配。点号(.)会被视为 database、schema 和 table 名的分隔符。如果需要在正则表达式中使用点号(.)匹配任意字符,必须使用反斜杠转义。<br>
139139
示例:inventory.dbo.\.*、inventory.dbo.user_table_[0-9]+、inventory.dbo.(app|web)_order_\.*</td>
140140
</tr>
141141
<tr>
142142
<td>tables.exclude</td>
143143
<td>optional</td>
144144
<td style="word-wrap: break-word;">(none)</td>
145145
<td>String</td>
146-
<td>在应用 `tables` 后需要排除的 SQL Server 表名。schema 和 table 名支持正则表达式。所有排除规则必须与 `tables` 选项使用同一个字面量数据库名。<br>
146+
<td>在应用 `tables` 后需要排除的 SQL Server 表名。schema 和 table 支持正则表达式匹配多个。所有排除规则必须与 `tables` 选项使用同一个固定库名。<br>
147147
示例:inventory.dbo.audit_\.*、inventory.dbo.tmp_[0-9]+</td>
148148
</tr>
149149
<tr>
@@ -307,10 +307,162 @@ pipeline:
307307
- `snapshot`:只读取快照。
308308
- `timestamp`:从 `scan.startup.timestamp-millis` 指定的时间戳开始读取。
309309

310+
## 数据类型映射
311+
312+
<div class="wy-table-responsive">
313+
<table class="colwidths-auto docutils">
314+
<thead>
315+
<tr>
316+
<th class="text-left" style="width:30%;">SQL Server type<a href="https://learn.microsoft.com/zh-cn/sql/t-sql/data-types/data-types-transact-sql"></a></th>
317+
<th class="text-left" style="width:20%;">CDC type</th>
318+
<th class="text-left" style="width:50%;">NOTE</th>
319+
</tr>
320+
</thead>
321+
<tbody>
322+
<tr>
323+
<td>BIT</td>
324+
<td>BOOLEAN</td>
325+
<td></td>
326+
</tr>
327+
<tr>
328+
<td>TINYINT</td>
329+
<td>SMALLINT</td>
330+
<td>SQL Server 中的 <code>TINYINT</code> 为无符号类型(取值 0-255),因此映射为范围更大的 <code>SMALLINT</code>。</td>
331+
</tr>
332+
<tr>
333+
<td>SMALLINT</td>
334+
<td>SMALLINT</td>
335+
<td></td>
336+
</tr>
337+
<tr>
338+
<td>INT</td>
339+
<td>INT</td>
340+
<td></td>
341+
</tr>
342+
<tr>
343+
<td>BIGINT</td>
344+
<td>BIGINT</td>
345+
<td></td>
346+
</tr>
347+
<tr>
348+
<td>REAL</td>
349+
<td>FLOAT</td>
350+
<td></td>
351+
</tr>
352+
<tr>
353+
<td>FLOAT</td>
354+
<td>DOUBLE</td>
355+
<td></td>
356+
</tr>
357+
<tr>
358+
<td>
359+
DECIMAL(p, s)<br>
360+
NUMERIC(p, s)
361+
</td>
362+
<td>DECIMAL(p, s)</td>
363+
<td>当精度大于 Flink 支持的上限 38 时,会回退为 <code>DECIMAL(38, 0)</code>。</td>
364+
</tr>
365+
<tr>
366+
<td>MONEY</td>
367+
<td>DECIMAL(19, 4)</td>
368+
<td></td>
369+
</tr>
370+
<tr>
371+
<td>SMALLMONEY</td>
372+
<td>DECIMAL(10, 4)</td>
373+
<td></td>
374+
</tr>
375+
<tr>
376+
<td>
377+
CHAR(n)<br>
378+
NCHAR(n)
379+
</td>
380+
<td>CHAR(n)</td>
381+
<td>当长度信息不可用时,映射为 <code>STRING</code>。</td>
382+
</tr>
383+
<tr>
384+
<td>
385+
VARCHAR(n)<br>
386+
NVARCHAR(n)
387+
</td>
388+
<td>VARCHAR(n)</td>
389+
<td>当长度信息不可用时,映射为 <code>STRING</code>。</td>
390+
</tr>
391+
<tr>
392+
<td>
393+
TEXT<br>
394+
NTEXT
395+
</td>
396+
<td>STRING</td>
397+
<td></td>
398+
</tr>
399+
<tr>
400+
<td>
401+
BINARY<br>
402+
VARBINARY<br>
403+
IMAGE
404+
</td>
405+
<td>BYTES</td>
406+
<td></td>
407+
</tr>
408+
<tr>
409+
<td>
410+
TIMESTAMP<br>
411+
ROWVERSION
412+
</td>
413+
<td>BYTES</td>
414+
<td>SQL Server 中的 <code>TIMESTAMP</code>/<code>ROWVERSION</code> 是行版本二进制值,并非日期时间类型。</td>
415+
</tr>
416+
<tr>
417+
<td>DATE</td>
418+
<td>DATE</td>
419+
<td></td>
420+
</tr>
421+
<tr>
422+
<td>TIME(p)</td>
423+
<td>TIME(p)</td>
424+
<td></td>
425+
</tr>
426+
<tr>
427+
<td>SMALLDATETIME</td>
428+
<td>TIMESTAMP(0)</td>
429+
<td></td>
430+
</tr>
431+
<tr>
432+
<td>DATETIME</td>
433+
<td>TIMESTAMP(3)</td>
434+
<td></td>
435+
</tr>
436+
<tr>
437+
<td>DATETIME2(p)</td>
438+
<td>TIMESTAMP(p)</td>
439+
<td>未显式指定精度时,默认精度为 7。</td>
440+
</tr>
441+
<tr>
442+
<td>DATETIMEOFFSET(p)</td>
443+
<td>TIMESTAMP_LTZ(p)</td>
444+
<td>未显式指定精度时,默认精度为 7。</td>
445+
</tr>
446+
<tr>
447+
<td>
448+
UNIQUEIDENTIFIER<br>
449+
XML<br>
450+
SQL_VARIANT<br>
451+
HIERARCHYID<br>
452+
GEOMETRY<br>
453+
GEOGRAPHY
454+
</td>
455+
<td>STRING</td>
456+
<td></td>
457+
</tr>
458+
</tbody>
459+
</table>
460+
</div>
461+
310462
## 限制
311463

312464
### 单数据库
313465

314-
`tables` 中的所有条目必须属于同一个字面量数据库。schema 和 table 名称支持正则表达式,但 database 部分不支持正则表达式
466+
`tables` 中的所有条目必须属于同一个数据库。数据库只支持单个固定库名,schema 和 table 支持正则表达式匹配多个
315467

316468
{{< top >}}

docs/content.zh/docs/core-concept/table-id.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ under the License.
3535

3636
下面是一些常见的外部数据系统及其对应的 Table Id 格式:
3737

38-
| 数据系统 | Table Id 构造参数 | 字符串示例 |
39-
|-----------------------|-------------------------|---------------------|
40-
| Oracle/PostgreSQL | database, schema, table | mydb.default.orders |
41-
| MySQL/Doris/StarRocks | database, table | mydb.orders |
42-
| Kafka | topic | orders |
38+
| 数据系统 | Table Id 构造参数 | 字符串示例 |
39+
|-------------------------------|-------------------------|---------------------|
40+
| Oracle/PostgreSQL/SQL Server | database, schema, table | mydb.dbo.orders |
41+
| MySQL/Doris/StarRocks | database, table | mydb.orders |
42+
| Kafka | topic | orders |

0 commit comments

Comments
 (0)