flink-faker用法示例(还没弄完,到时候再说)

本文针对的是flink-faker这个连接器

https://github.com/knaufk/flink-faker

下面的使用案例来自ververica的flink-sql-cookbook

 

 

 

 

 

 

数据类型(不要忘记最后添加逗号) 生成该数据的设置方式(不要忘记最后添加逗号) 生成的数据举例
连接器 'connector' = 'faker', -
client_ip STRING 'fields.client_ip.expression' = '#{Internet.publicIpV4Address}'  
'fields.client_ip.expression'  '#{Internet.publicIpV4Address}'  
product_id BIGINT    
price DECIMAL(32, 2)    
doctor STRING 'fields.doctor.expression' = '#{dr_who.the_doctors}' Seventh Doctor
sighting_time TIMESTAMP(3) 'fields.sighting_time.expression' = '#{date.past ''15'',''SECONDS''}'

2021-01-05T11:54:41

 

 

>     client_ip STRING,
>     client_identity STRING, 
>     userid STRING, 
>     user_agent STRING,
>     log_time TIMESTAMP(3),
>     request_line STRING, 
>     status_code STRING, 
>     size INT
> ) WITH (
>   'connector' = 'faker', 
>   'fields.client_ip.expression' = '#{Internet.publicIpV4Address}',
>   'fields.client_identity.expression' =  '-',
>   'fields.userid.expression' =  '-',
>   'fields.user_agent.expression' = '#{Internet.userAgentAny}',
>   'fields.log_time.expression' =  '#{date.past ''15'',''5'',''SECONDS''}',
>   'fields.request_line.expression' = '#{regexify ''(GET|POST|PUT|PATCH){1}''} #{regexify ''(/search\.html|/login\.html|/prod\.html|cart\.html|/order\.html){1}''} #{regexify ''(HTTP/1\.1|HTTP/2|/HTTP/1\.0){1}''}',
>   'fields.status_code.expression' = '#{regexify ''(200|201|204|400|401|403|301){1}''}',
>   'fields.size.expression' = '#{number.numberBetween ''100'',''10000000''}'
> );

 

 

Reference:

[1]DataGen SQL Connector

 

 

 

 

上一篇:Fluttr应用——5个高效的Flutter开发工具


下一篇:都 2021 年了,居然还有人在手写测试数据?