当前位置:网站首页>Sparksql and flinksql create and link table records
Sparksql and flinksql create and link table records
2022-07-28 08:34:00 【Lu Xinhang】
start-up flink sql:bin/sql-client.sh
Build table
flink Create a table
create table iceberg.xxx.xxx
(
id STRING comment 'id',
dt STRING comment ' Partition field '
)
PARTITIONED BY (dt)
with (
'write.format.default' = 'parquet', -- Specify the file storage format , Default parquet
'write.parquet.compression-codec' = 'gzip', -- Specify the file compression format ,
'commit.manifest-merge.enabled' = 'true', -- Auto merge on write manifest
'history.expire.max-snapshot-age-ms' = '43200000', -- Historical snapshot retention time (ms), Default 5 God , here 12h
'engine.hive.enabled' = 'true', -- Support hive Inquire about
'write.metadata.delete-after-commit.enabled' = 'true', -- Delete the oldest metadata file after each new metadata file is created
'write.metadata.previous-versions-max' = '20', -- The maximum number of metadata files of previous versions deleted after submission
'write.metadata.compression-codec' = 'gzip', -- Enable metadata compression as gzip Format
'location' = 'hdfs://ns1/lakehouse/schema_name/table_name' -- Appoint hdfs Address
);
spark Create a table
create table iceberg.xxx.xxxx
(
id STRING comment 'id',
dt STRING comment ' Partition field '
)
using iceberg
partitioned by (dt)
location 'hdfs://xxx/lakehouse/schema_name/table_name'
tblproperties (
'write.format.default' = 'parquet', -- Specify the file storage format , Default parquet
'write.parquet.compression-codec' = 'gzip', -- Specify the file compression format ,
'commit.manifest-merge.enabled' = 'true', -- Auto merge on write manifest
'history.expire.max-snapshot-age-ms' = '43200000', -- Historical snapshot retention time (ms), Default 5 God , here 12h
'engine.hive.enabled' = 'true', -- Support hive Inquire about
'write.metadata.delete-after-commit.enabled' = 'true', -- Delete the oldest metadata file after each new metadata file is created
'write.metadata.previous-versions-max' = '20', -- The maximum number of metadata files of previous versions deleted after submission
'write.metadata.compression-codec' = 'gzip' -- Enable metadata compression as gzip Format
);
Create a target table based on the source table
CREATE TABLE iceberg.schema_name.table_name
using iceberg
partitioned by (dt)
location 'hdfs://ns1/lakehouse/schema_name/table_name'
tblproperties (
'write.format.default' = 'parquet',
'write.parquet.compression-codec' = 'gzip',
'commit.manifest-merge.enabled' = 'true',
'engine.hive.enabled' = 'true',
'write.metadata.delete-after-commit.enabled' = 'true',
'write.metadata.previous-versions-max' = '20',
'write.metadata.compression-codec' = 'gzip'
) AS SELECT * from iceberg.schema_name.original_table_name where 1=2;
Connect mysql、 sql server
spark
-- mysql
CREATE
TEMPORARY
VIEW tb_order_group
USING org.apache.spark.sql.jdbc
OPTIONS (
url 'jdbc:mysql://xx.xxx.xx.xx:4909/db_name?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull',
dbtable 'xxx',
user 'xxx',
password 'xxx'
);
-- sqlserver
CREATE
TEMPORARY
VIEW gxywhz
USING org.apache.spark.sql.jdbc
OPTIONS (
url 'jdbc:sqlserver://192.168.1.xx:xxx;DatabaseName=xxx',
dbtable 'dbo.xxx',
user 'xxx',
password 'xxxx'
);
flink
-- Connector Connect Create a mapping table
CREATE TABLE mysql_source
(
id int comment 'id'
primary key (id) NOT ENFORCED
) WITH (
'connector' = 'jdbc',
'url' = 'jdbc:mysql://192.168.xx.xx:3306/xxx',
'table-name' = 'tableName',
'driver' = 'com.mysql.jdbc.Driver',
'username' = 'root',
'password' = 'xxx'
);
CREATE TABLE sqlserver_source
(
id STRING comment 'id'
) WITH (
'connector' = 'jdbc',
'url' = 'jdbc:jtds:sqlserver://192.168.xx.xxx:10009;databaseName=xxx;useLOBs=false',
'table-name' = 'schema.tableName',
'driver' = 'net.sourceforge.jtds.jdbc.Driver',
'username' = 'xx',
'password' = 'xxxxx'
);
边栏推荐
- QT 怎么删除布局里的所有控件?
- VK1620温控仪/智能电表LED数显驱动芯片3/4线接口内置 RC振荡器,提供技术支持
- Creation of status bar (29)
- MCU IO port controls 12V voltage on and off, MOS and triode circuit
- 阻塞队列LinkedBlockingQueue 源码解析
- ASP. Net core foundation V
- 招贤纳士,GBASE高端人才招募进行中
- Three different numbers with 0 in leetcode/ array
- Can‘t connect to server on ‘IP‘ (60)
- js卡通英文字母打字小游戏源码
猜你喜欢

Spiral matrix

Allure use
![[Qt5] a method of multi window parameter transmission (using custom signal slot) and case code download](/img/6d/870add6179f0e3a2f9b719f79594f3.png)
[Qt5] a method of multi window parameter transmission (using custom signal slot) and case code download

百度智能云九州区县大脑,描绘城乡新蓝图!

49-OpenCv深入分析轮廓

QT uses semaphores to control threads (qsemaphore)

本人男,27岁技术经理,收入太高,心头慌得一比

网络安全漏洞分析与漏洞复现
![MySQL query error [err] 1046 - no database selected](/img/32/7d877571397c1e2024ec488b783e87.png)
MySQL query error [err] 1046 - no database selected

tkMapper的使用-超详细
随机推荐
Matlab (3) matlab program flow control statement
Creation of status bar (29)
Allure use
数字签名和CA证书
Prescan quick start to proficient in lecture 17, speed curve editor
MCU IO port controls 12V voltage on and off, MOS and triode circuit
业务数字化飞速奔跑,管理数字化亟待出发
金属质感登录框样式
Viewing vantage's self drive from the "three good" kitchen electricity standard and the value proposition of "serious life"
2022牛客多校第二场解题报告
Regular expression for mobile number verification
单片机IO口控制12V电压通断,MOS和三极管电路
Prescan quick start to master the track editing path of Lecture 16
How to use QT help documents
【OpenCV】生成透明的PNG图像
[Qt5] QT small software release
The fourth phase (2021-2022) research on the implementation of cloud native technology in traditional industries - central state-owned enterprises was officially released
五张图看懂EMI电磁干扰的传播过程-方波陡峭程度对高频成分的影响,时序到频域频谱图形,波形形状对EMI辐射的影响。
Plantuml Usage Summary
Find out whether the number exists from the matrix