您现在的位置是:首页 > 文章详情

JDBC SQL Server Source Connector: 一览与实践

日期:2023-11-06点击:228

file

<section id="nice" data-tool="mdnice编辑器" data-website="https://www.mdnice.com" style="font-size: 16px; padding: 0 10px; line-height: 1.6; word-spacing: 0px; letter-spacing: 0px; word-break: break-word; word-wrap: break-word; text-align: left; color: #333; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;"><p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; color: black; font-size: 16px; line-height: 2; font-weight: 400;">在快速发展的数据驱动业务环境中,确保数据在各个系统间高效、准确地同步至关重要。为了进一步的数据处理和分析,经常需要将这些数据同步到其他数据处理系统。Apache SeaTunnel 提供了一个强大而灵活的数据集成框架,使得从 SQL Server 到其他系统的数据同步变得简单且高效。</p> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; color: black; font-size: 16px; line-height: 2; font-weight: 400; margin-top: 16px;">本文档将指导您如何配置 Apache SeaTunnel,使用 JDBC SQL Server Source Connector 来实现数据的有效同步。</p> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="border: none; display: block; font-size: 0.9em; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-bottom: 20px; margin-top: 20px; border-left-color: #b2aec5; background: #fff9f9;"> <p style="padding-top: 8px; padding-bottom: 8px; font-size: 16px; font-weight: 400; margin: 0px; color: #666; line-height: 2;">JDBC SQL Server Source Connector</p> </blockquote> <h2 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; position: relative; font-size: 20px;"><span class="prefix" style="display: none;"></span><span class="content" style="border-left: 4px solid; padding-left: 10px;">支持 SQL Server 版本</span><span class="suffix"></span></h2> <ul data-tool="mdnice编辑器" style="margin-top: 8px; margin-bottom: 8px; padding-left: 25px; color: black; list-style-type: disc;"> <li><section style="margin-top: 5px; margin-bottom: 5px; text-align: left; color: rgb(1,1,1); font-weight: 500; line-height: 2;">服务器:2008(或更高版本,仅供信息参考)</section></li></ul> <h2 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; position: relative; font-size: 20px;"><span class="prefix" style="display: none;"></span><span class="content" style="border-left: 4px solid; padding-left: 10px;">支持以下引擎</span><span class="suffix"></span></h2> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="border: none; display: block; font-size: 0.9em; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-bottom: 20px; margin-top: 20px; border-left-color: #b2aec5; background: #fff9f9;"> <p style="padding-top: 8px; padding-bottom: 8px; font-size: 16px; font-weight: 400; margin: 0px; color: #666; line-height: 2;">Spark <br> Flink <br> Seatunnel Zeta <br></p> </blockquote> <h2 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; position: relative; font-size: 20px;"><span class="prefix" style="display: none;"></span><span class="content" style="border-left: 4px solid; padding-left: 10px;">主要特点</span><span class="suffix"></span></h2> <ul data-tool="mdnice编辑器" style="margin-top: 8px; margin-bottom: 8px; padding-left: 25px; color: black; list-style-type: disc;"> <li><section style="margin-top: 5px; margin-bottom: 5px; text-align: left; color: rgb(1,1,1); font-weight: 500; line-height: 2;">[x] <a href="../../concept/connector-v2-features.md" style="word-wrap: break-word; color: #036aca; border-bottom: 0; font-weight: 400; text-decoration: none;">批处理</a></section></li><li><section style="margin-top: 5px; margin-bottom: 5px; text-align: left; color: rgb(1,1,1); font-weight: 500; line-height: 2;">[ ] <a href="../../concept/connector-v2-features.md" style="word-wrap: break-word; color: #036aca; border-bottom: 0; font-weight: 400; text-decoration: none;">流处理</a></section></li><li><section style="margin-top: 5px; margin-bottom: 5px; text-align: left; color: rgb(1,1,1); font-weight: 500; line-height: 2;">[x] <a href="../../concept/connector-v2-features.md" style="word-wrap: break-word; color: #036aca; border-bottom: 0; font-weight: 400; text-decoration: none;">精准一次性</a></section></li><li><section style="margin-top: 5px; margin-bottom: 5px; text-align: left; color: rgb(1,1,1); font-weight: 500; line-height: 2;">[x] <a href="../../concept/connector-v2-features.md" style="word-wrap: break-word; color: #036aca; border-bottom: 0; font-weight: 400; text-decoration: none;">列投影</a></section></li><li><section style="margin-top: 5px; margin-bottom: 5px; text-align: left; color: rgb(1,1,1); font-weight: 500; line-height: 2;">[x] <a href="../../concept/connector-v2-features.md" style="word-wrap: break-word; color: #036aca; border-bottom: 0; font-weight: 400; text-decoration: none;">并行处理</a></section></li><li><section style="margin-top: 5px; margin-bottom: 5px; text-align: left; color: rgb(1,1,1); font-weight: 500; line-height: 2;">[x] <a href="../../concept/connector-v2-features.md" style="word-wrap: break-word; color: #036aca; border-bottom: 0; font-weight: 400; text-decoration: none;">支持用户定义拆分</a></section></li></ul> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="border: none; display: block; font-size: 0.9em; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-bottom: 20px; margin-top: 20px; border-left-color: #b2aec5; background: #fff9f9;"> <p style="padding-top: 8px; padding-bottom: 8px; font-size: 16px; font-weight: 400; margin: 0px; color: #666; line-height: 2;">支持查询 SQL 并能够实现投影效果。</p> </blockquote> <h2 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; position: relative; font-size: 20px;"><span class="prefix" style="display: none;"></span><span class="content" style="border-left: 4px solid; padding-left: 10px;">描述</span><span class="suffix"></span></h2> <p data-tool="mdnice编辑器" style="padding-top: 8px; padding-bottom: 8px; margin: 0; color: black; font-size: 16px; line-height: 2; font-weight: 400;">通过 JDBC 读取外部数据源数据。</p> <h2 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; position: relative; font-size: 20px;"><span class="prefix" style="display: none;"></span><span class="content" style="border-left: 4px solid; padding-left: 10px;">支持的数据源信息</span><span class="suffix"></span></h2> <section class="table-container" data-tool="mdnice编辑器" style="overflow-x: auto;"><table style="display: table; text-align: left; border-spacing: 0;"> <thead> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">数据源</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">支持的版本</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">驱动</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">URL</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">Maven</th> </tr> </thead> <tbody style="border: 0;"> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">SQL Server</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">支持版本 &gt;= 2008</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">com.microsoft.sqlserver.jdbc.SQLServerDriver</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">jdbc:sqlserver://localhost:1433</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;"><a href="https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc" style="word-wrap: break-word; color: #036aca; border-bottom: 0; font-weight: 400; text-decoration: none;">下载</a></td> </tr> </tbody> </table> </section><h2 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; position: relative; font-size: 20px;"><span class="prefix" style="display: none;"></span><span class="content" style="border-left: 4px solid; padding-left: 10px;">数据库依赖</span><span class="suffix"></span></h2> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="border: none; display: block; font-size: 0.9em; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-bottom: 20px; margin-top: 20px; border-left-color: #b2aec5; background: #fff9f9;"> <p style="padding-top: 8px; padding-bottom: 8px; font-size: 16px; font-weight: 400; margin: 0px; color: #666; line-height: 2;">请下载与 'Maven' 对应的支持列表,并将其复制到 '<span class="span-inline-equation" style="cursor:pointer"><img class="Formula-image" data-eeimg="true" src alt="SEATNUNNEL_HOME/plugins/jdbc/lib/' 工作目录

例如 SQL Server 数据源:cp mssql-jdbc-xxx.jar " style="display: block; margin: 0 auto; max-width: 100%;"></span>SEATNUNNEL_HOME/plugins/jdbc/lib/</p>

</blockquote> <h2 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; position: relative; font-size: 20px;"><span class="prefix" style="display: none;"></span><span class="content" style="border-left: 4px solid; padding-left: 10px;">数据类型映射</span><span class="suffix"></span></h2> <section class="table-container" data-tool="mdnice编辑器" style="overflow-x: auto;"><table style="display: table; text-align: left; border-spacing: 0;"> <thead> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">SQL Server 数据类型</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">Seatunnel 数据类型</th> </tr> </thead> <tbody style="border: 0;"> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">BIT</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">BOOLEAN</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">TINYINT<br>SMALLINT</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">SHORT</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">INTEGER</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">INT</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">BIGINT</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">LONG</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">DECIMAL<br>NUMERIC<br>MONEY<br>SMALLMONEY</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">DECIMAL((指定列的指定列大小)+1,<br>(获取指定列的小数点右边的数字的数量。)))</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">REAL</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">FLOAT</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">FLOAT</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">DOUBLE</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">CHAR<br>NCHAR<br>VARCHAR<br>NTEXT<br>NVARCHAR<br>TEXT</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">STRING</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">DATE</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">LOCAL_DATE</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">TIME</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">LOCAL_TIME</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">DATETIME<br>DATETIME2<br>SMALLDATETIME<br>DATETIMEOFFSET</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">LOCAL_DATE_TIME</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">TIMESTAMP<br>BINARY<br>VARBINARY<br>IMAGE<br>UNKNOWN</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">尚不支持</td> </tr> </tbody> </table> </section><h2 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; position: relative; font-size: 20px;"><span class="prefix" style="display: none;"></span><span class="content" style="border-left: 4px solid; padding-left: 10px;">源选项</span><span class="suffix"></span></h2> <section class="table-container" data-tool="mdnice编辑器" style="overflow-x: auto;"><table style="display: table; text-align: left; border-spacing: 0;"> <thead> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">名称</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">类型</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">必需</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">默认值</th> <th style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; font-weight: bold; background-color: #d4f1ff; min-width: 85px;">描述</th> </tr> </thead> <tbody style="border: 0;"> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">url</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">字符串</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">是</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">-</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">JDBC 连接的 URL。例如:jdbc:sqlserver://127.0.0.1:1434;database=TestDB</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">driver</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">字符串</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">是</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">-</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">用于连接到远程数据源的 JDBC 类名,如果使用 SQL Server,则值为 <code>com.microsoft.sqlserver.jdbc.SQLServerDriver</code>。</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">user</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">字符串</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">否</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">-</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">连接实例的用户名</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">password</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">字符串</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">否</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">-</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">连接实例的密码</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">query</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">字符串</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">是</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">-</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">查询语句</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">connection_check_timeout_sec</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">整数</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">否</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">30</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">等待用于验证连接的数据库操作完成的秒数</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">partition_column</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">字符串</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">否</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">-</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">并行处理的分区列,仅支持数值类型。</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">partition_lower_bound</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">长整数</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">否</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">-</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">用于扫描的 partition_column 最小值,如果未设置,SeaTunnel 将查询数据库获取最小值。</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">partition_upper_bound</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">长整数</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">否</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">-</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">用于扫描的 partition_column 最大值,如果未设置,SeaTunnel 将查询数据库获取最大值。</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">partition_num</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">整数</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">否</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">作业并行度</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">分区计数的数量,仅支持正整数。默认值为作业并行度。</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: white;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">fetch_size</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">整数</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">否</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">0</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">对返回大量对象的查询,您可以配置查询中使用的行抓取大小,以减少满足选择条件所需的数据库命中次数,从而提高性能。<br>零表示使用 JDBC 默认值。</td> </tr> <tr style="border: 0; border-top: 1px solid #ccc; background-color: #F8F8F8;"> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">common-options</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;"></td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">否</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">-</td> <td style="font-size: 16px; border: 1px solid #ccc; padding: 5px 10px; text-align: left; min-width: 85px;">源插件的常见参数,请参阅 <a href="common-options.md" style="word-wrap: break-word; color: #036aca; border-bottom: 0; font-weight: 400; text-decoration: none;">源常用选项</a> 以获取详细信息。</td> </tr> </tbody> </table> </section><h2 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; position: relative; font-size: 20px;"><span class="prefix" style="display: none;"></span><span class="content" style="border-left: 4px solid; padding-left: 10px;">提示</span><span class="suffix"></span></h2> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="border: none; display: block; font-size: 0.9em; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-bottom: 20px; margin-top: 20px; border-left-color: #b2aec5; background: #fff9f9;"> <p style="padding-top: 8px; padding-bottom: 8px; font-size: 16px; font-weight: 400; margin: 0px; color: #666; line-height: 2;">如果未设置 partition_column,则将以单一并发运行;如果设置了 partition_column,则将根据任务的并发度进行并行执行。</p> </blockquote> <h2 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; position: relative; font-size: 20px;"><span class="prefix" style="display: none;"></span><span class="content" style="border-left: 4px solid; padding-left: 10px;">任务示例</span><span class="suffix"></span></h2> <h3 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; font-size: 16px;"><span class="prefix" style="display: none;"></span><span class="content">简单:</span><span class="suffix" style="display: none;"></span></h3> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="border: none; display: block; font-size: 0.9em; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-bottom: 20px; margin-top: 20px; border-left-color: #b2aec5; background: #fff9f9;"> <p style="padding-top: 8px; padding-bottom: 8px; font-size: 16px; font-weight: 400; margin: 0px; color: #666; line-height: 2;">简单的单一任务以读取数据表</p> </blockquote> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; text-align: left;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #272822; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #ddd; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #272822; border-radius: 5px;"><span class="hljs-section" style="color: #a6e22e; font-weight: bold; line-height: 26px;">#&nbsp;定义运行时环境</span><br>env&nbsp;{<br>&nbsp;&nbsp;#&nbsp;您可以在此处设置&nbsp;Flink&nbsp;配置<br>&nbsp;&nbsp;execution.parallelism&nbsp;=&nbsp;1<br>&nbsp;&nbsp;job.mode&nbsp;=&nbsp;"BATCH"<br>}<br>source{<br><span class="hljs-code" style="color: #66d9ef; line-height: 26px;">&nbsp;&nbsp;&nbsp;&nbsp;Jdbc&nbsp;{</span><br><span class="hljs-code" style="color: #66d9ef; line-height: 26px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;driver&nbsp;=&nbsp;com.microsoft.sqlserver.jdbc.SQLServerDriver</span><br><span class="hljs-code" style="color: #66d9ef; line-height: 26px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url&nbsp;=&nbsp;"jdbc:sqlserver://localhost:1433;databaseName=column_type_test"</span><br><span class="hljs-code" style="color: #66d9ef; line-height: 26px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user&nbsp;=&nbsp;SA</span><br><span class="hljs-code" style="color: #66d9ef; line-height: 26px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;password&nbsp;=&nbsp;"Y.sa123456"</span><br><span class="hljs-code" style="color: #66d9ef; line-height: 26px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;=&nbsp;"select&nbsp;*&nbsp;from&nbsp;full_types_jdbc"</span><br><span class="hljs-code" style="color: #66d9ef; line-height: 26px;">&nbsp;&nbsp;&nbsp;&nbsp;}</span><br>}<br><br>transform&nbsp;{<br><span class="hljs-code" style="color: #66d9ef; line-height: 26px;">&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;如果您想要获取有关如何配置&nbsp;seatunnel&nbsp;和查看变换插件的完整列表的更多信息,</span><br><span class="hljs-code" style="color: #66d9ef; line-height: 26px;">&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;请转到&nbsp;[seatunnel.apache.org/docs/transform-v2/sql](https://seatunnel.apache.org/docs/transform-v2/sql)</span><br>}<br><br>sink&nbsp;{<br><span class="hljs-code" style="color: #66d9ef; line-height: 26px;">&nbsp;&nbsp;&nbsp;&nbsp;Console&nbsp;{}</span><br>}<br><br></code></pre> <h3 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; font-size: 16px;"><span class="prefix" style="display: none;"></span><span class="content">并行:</span><span class="suffix" style="display: none;"></span></h3> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="border: none; display: block; font-size: 0.9em; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-bottom: 20px; margin-top: 20px; border-left-color: #b2aec5; background: #fff9f9;"> <p style="padding-top: 8px; padding-bottom: 8px; font-size: 16px; font-weight: 400; margin: 0px; color: #666; line-height: 2;">使用您配置的分片字段和分片数据并行读取您的查询表,如果您希望读取整个表,可以这样做:</p> </blockquote> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; text-align: left;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #272822; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #ddd; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #272822; border-radius: 5px;">env&nbsp;{<br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;您可以在此处设置&nbsp;Flink&nbsp;配置</span><br>&nbsp;&nbsp;execution.parallelism&nbsp;=&nbsp;10<br>&nbsp;&nbsp;job.mode&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"BATCH"</span><br>}<br><br><span class="hljs-built_in" style="color: #a6e22e; line-height: 26px;">source</span>&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;Jdbc&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;driver&nbsp;=&nbsp;com.microsoft.sqlserver.jdbc.SQLServerDriver<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"jdbc:sqlserver://localhost:1433;databaseName=column_type_test"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user&nbsp;=&nbsp;SA<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;password&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"Y.sa123456"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;根据需要定义查询逻辑</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"select&nbsp;*&nbsp;from&nbsp;full_types_jdbc"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;并行分片读取字段</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;partition_column&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"id"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;片段数量</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;partition_num&nbsp;=&nbsp;10<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><br>transform&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;如果您想要获取有关如何配置&nbsp;Seatunnel&nbsp;和查看转换插件的完整列表的更多信息,</span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;请转到&nbsp;https://seatunnel.apache.org/docs/transform-v2/sql</span><br>}<br><br>sink&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;Console&nbsp;{}<br>}<br></code></pre> <h3 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; font-size: 16px;"><span class="prefix" style="display: none;"></span><span class="content">并行:</span><span class="suffix" style="display: none;"></span></h3> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="border: none; display: block; font-size: 0.9em; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-bottom: 20px; margin-top: 20px; border-left-color: #b2aec5; background: #fff9f9;"> <p style="padding-top: 8px; padding-bottom: 8px; font-size: 16px; font-weight: 400; margin: 0px; color: #666; line-height: 2;">使用您配置的分片字段和分片数据并行读取您的查询表,如果您希望读取整个表,可以这样做:</p> </blockquote> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; text-align: left;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #272822; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #ddd; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #272822; border-radius: 5px;">env&nbsp;{<br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;您可以在此处设置&nbsp;Flink&nbsp;配置</span><br>&nbsp;&nbsp;execution.parallelism&nbsp;=&nbsp;10<br>&nbsp;&nbsp;job.mode&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"BATCH"</span><br>}<br><br><span class="hljs-built_in" style="color: #a6e22e; line-height: 26px;">source</span>&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;Jdbc&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;driver&nbsp;=&nbsp;com.microsoft.sqlserver.jdbc.SQLServerDriver<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"jdbc:sqlserver://localhost:1433;databaseName=column_type_test"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user&nbsp;=&nbsp;SA<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;password&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"Y.sa123456"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;根据需要定义查询逻辑</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"select&nbsp;*&nbsp;from&nbsp;full_types_jdbc"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;并行分片读取字段</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;partition_column&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"id"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;片段数量</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;partition_num&nbsp;=&nbsp;10<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><br>transform&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;如果您想要获取有关如何配置&nbsp;Seatunnel&nbsp;和查看转换插件的完整列表的更多信息,</span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;请转到&nbsp;https://seatunnel.apache.org/docs/transform-v2/sql</span><br>}<br><br>sink&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;Console&nbsp;{}<br>}<br></code></pre> <h3 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; font-size: 16px;"><span class="prefix" style="display: none;"></span><span class="content">并行:</span><span class="suffix" style="display: none;"></span></h3> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="border: none; display: block; font-size: 0.9em; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-bottom: 20px; margin-top: 20px; border-left-color: #b2aec5; background: #fff9f9;"> <p style="padding-top: 8px; padding-bottom: 8px; font-size: 16px; font-weight: 400; margin: 0px; color: #666; line-height: 2;">使用您配置的分片字段和分片数据并行读取您的查询表,如果您希望读取整个表,可以这样做:</p> </blockquote> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; text-align: left;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #272822; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #ddd; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #272822; border-radius: 5px;">env&nbsp;{<br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;您可以在此处设置&nbsp;Flink&nbsp;配置</span><br>&nbsp;&nbsp;execution.parallelism&nbsp;=&nbsp;10<br>&nbsp;&nbsp;job.mode&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"BATCH"</span><br>}<br><br><span class="hljs-built_in" style="color: #a6e22e; line-height: 26px;">source</span>&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;Jdbc&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;driver&nbsp;=&nbsp;com.microsoft.sqlserver.jdbc.SQLServerDriver<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"jdbc:sqlserver://localhost:1433;databaseName=column_type_test"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user&nbsp;=&nbsp;SA<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;password&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"Y.sa123456"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;根据需要定义查询逻辑</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"select&nbsp;*&nbsp;from&nbsp;full_types_jdbc"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;并行分片读取字段</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;partition_column&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"id"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;片段数量</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;partition_num&nbsp;=&nbsp;10<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><br>transform&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;如果您想要获取有关如何配置&nbsp;Seatunnel&nbsp;和查看转换插件的完整列表的更多信息,</span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;请转到&nbsp;https://seatunnel.apache.org/docs/transform-v2/sql</span><br>}<br><br>sink&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;Console&nbsp;{}<br>}<br></code></pre> <h3 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; font-size: 16px;"><span class="prefix" style="display: none;"></span><span class="content">并行:</span><span class="suffix" style="display: none;"></span></h3> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="border: none; display: block; font-size: 0.9em; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-bottom: 20px; margin-top: 20px; border-left-color: #b2aec5; background: #fff9f9;"> <p style="padding-top: 8px; padding-bottom: 8px; font-size: 16px; font-weight: 400; margin: 0px; color: #666; line-height: 2;">使用您配置的分片字段和分片数据并行读取您的查询表,如果您希望读取整个表,可以这样做:</p> </blockquote> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; text-align: left;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #272822; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #ddd; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #272822; border-radius: 5px;">env&nbsp;{<br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;您可以在此处设置&nbsp;Flink&nbsp;配置</span><br>&nbsp;&nbsp;execution.parallelism&nbsp;=&nbsp;10<br>&nbsp;&nbsp;job.mode&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"BATCH"</span><br>}<br><br><span class="hljs-built_in" style="color: #a6e22e; line-height: 26px;">source</span>&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;Jdbc&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;driver&nbsp;=&nbsp;com.microsoft.sqlserver.jdbc.SQLServerDriver<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"jdbc:sqlserver://localhost:1433;databaseName=column_type_test"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user&nbsp;=&nbsp;SA<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;password&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"Y.sa123456"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;根据需要定义查询逻辑</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"select&nbsp;*&nbsp;from&nbsp;full_types_jdbc"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;并行分片读取字段</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;partition_column&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"id"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;片段数量</span><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;partition_num&nbsp;=&nbsp;10<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><br>transform&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;如果您想要获取有关如何配置&nbsp;Seatunnel&nbsp;和查看转换插件的完整列表的更多信息,</span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;请转到&nbsp;https://seatunnel.apache.org/docs/transform-v2/sql</span><br>}<br><br>sink&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;Console&nbsp;{}<br>}<br></code></pre> <h3 data-tool="mdnice编辑器" style="margin-top: 30px; margin-bottom: 15px; font-weight: bold; padding: 30px 0; margin: 0; color: #135ce0; font-size: 16px;"><span class="prefix" style="display: none;"></span><span class="content">分段并行读取示例:</span><span class="suffix" style="display: none;"></span></h3> <blockquote class="multiquote-1" data-tool="mdnice编辑器" style="border: none; display: block; font-size: 0.9em; overflow: auto; overflow-scrolling: touch; border-left: 3px solid rgba(0, 0, 0, 0.4); color: #6a737d; padding-top: 10px; padding-bottom: 10px; padding-left: 20px; padding-right: 10px; margin-bottom: 20px; margin-top: 20px; border-left-color: #b2aec5; background: #fff9f9;"> <p style="padding-top: 8px; padding-bottom: 8px; font-size: 16px; font-weight: 400; margin: 0px; color: #666; line-height: 2;">这是一个快速并行读取数据的分片示例</p> </blockquote> <pre class="custom" data-tool="mdnice编辑器" style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px; text-align: left;"><span style="display: block; background: url(https://files.mdnice.com/user/3441/876cad08-0422-409d-bb5a-08afec5da8ee.svg); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #272822; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #ddd; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #272822; border-radius: 5px;">env&nbsp;{<br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;您可以在此处设置引擎配置</span><br>&nbsp;&nbsp;execution.parallelism&nbsp;=&nbsp;10<br>}<br><br><span class="hljs-built_in" style="color: #a6e22e; line-height: 26px;">source</span>&nbsp;{<br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;这是一个示例源插件,仅用于测试和展示源插件的功能</span><br>&nbsp;&nbsp;Jdbc&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;driver&nbsp;=&nbsp;com.microsoft.sqlserver.jdbc.SQLServerDriver<br>&nbsp;&nbsp;&nbsp;&nbsp;url&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"jdbc:sqlserver://localhost:1433;databaseName=column_type_test"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;user&nbsp;=&nbsp;SA<br>&nbsp;&nbsp;&nbsp;&nbsp;password&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"Y.sa123456"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;query&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"select&nbsp;*&nbsp;from&nbsp;column_type_test.dbo.full_types_jdbc"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;并行分片读取字段</span><br>&nbsp;&nbsp;&nbsp;&nbsp;partition_column&nbsp;=&nbsp;<span class="hljs-string" style="color: #a6e22e; line-height: 26px;">"id"</span><br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;片段数量</span><br>&nbsp;&nbsp;&nbsp;&nbsp;partition_num&nbsp;=&nbsp;10<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;如果您想要获取有关如何配置&nbsp;Seatunnel&nbsp;和查看源插件的完整列表的更多信息,</span><br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;请转到&nbsp;https://seatunnel.apache.org/docs/connector-v2/source/Jdbc</span><br>}<br><br>transform&nbsp;{<br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;如果您想要获取有关如何配置&nbsp;Seatunnel&nbsp;和查看转换插件的完整列表的更多信息,</span><br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;请转到&nbsp;https://seatunnel.apache.org/docs/transform-v2/sql</span><br>}<br><br>sink&nbsp;{<br>&nbsp;&nbsp;Console&nbsp;{}<br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;如果您想要获取有关如何配置&nbsp;Seatunnel&nbsp;和查看接收插件的完整列表的更多信息,</span><br>&nbsp;&nbsp;<span class="hljs-comment" style="color: #75715e; line-height: 26px;">#&nbsp;请转到&nbsp;https://seatunnel.apache.org/docs/connector-v2/sink/Jdbc</span><br>}<br></code></pre> </section> > 本文由 [白鲸开源科技](http://www.whaleops.com) 提供发布支持!

原文链接:https://my.oschina.net/SeaTunnel/blog/10141161
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章