把CSV存好,放这里:
添加流程:
id: extract-load-mysql
namespace: company.team
variables:
table: new
tasks:
- id: extract
type: io.kestra.plugin.core.http.Download
uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv
- id: enable_local_files
type: io.kestra.plugin.jdbc.mysql.Query
sql: SET GLOBAL local_infile=1;
- id: create_table
type: io.kestra.plugin.jdbc.mysql.Query
sql: |
create table if not exists {{ vars.table }}
(
order_id integer,
customer_name varchar(50),
customer_email varchar(50),
product_id integer,
price real,
quantity integer,
total real
);
- id: load_data
type: io.kestra.plugin.jdbc.mysql.Query
inputFile: "{{ outputs.extract.uri }}"
sql: |
LOAD DATA LOCAL INFILE '{{ inputFile }}'
INTO TABLE {{ vars.table }}
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;
pluginDefaults:
- type: io.kestra.plugin.jdbc.mysql.Query
values:
url: jdbc:mysql://localhost:3307/test
username: root
password: "LALALLA"
执行
了解 工作生活心情记忆 的更多信息
Subscribe to get the latest posts sent to your email.