spark SQL

Last updated on November 22, 2024 pm

🧙 Questions

☄️ Ideas

CREATE TEMPORARY VIEW from_table
USING org.apache.spark.sql.jdbc
OPTIONS (
    driver 'com.mysql.cj.jdbc.Driver',
    url 'jdbc:mysql://localhost:30306/demo',
    user 'root',
    password 'ispong123',
    dbtable 'users'
);
    
CREATE TEMPORARY VIEW to_table
USING org.apache.spark.sql.jdbc
OPTIONS (
    driver 'com.mysql.cj.jdbc.Driver',
    url 'jdbc:mysql://localhost:30306/demo',
    user 'root',
    password 'ispong123',
    dbtable 'users2'
);

insert into to_table select * from from_table;

查询lineorder表条数

CREATE TEMPORARY VIEW lineorder
USING org.apache.spark.sql.jdbc
OPTIONS (
    driver 'com.mysql.cj.jdbc.Driver',
    url 'jdbc:mysql://172.25.28.232:3306/isxcode_db',
    user 'root',
    password 'ispong123',
    dbtable 'lineorder'
);

select count(1) from lineorder;

spark SQL
https://ispong.isxcode.com/hadoop/spark/spark SQL/
Author
ispong
Posted on
August 9, 2023
Licensed under