Skip to content

Instantly share code, notes, and snippets.

@welly87
Created October 1, 2020 06:34
Show Gist options
  • Save welly87/d8e3c8a36e83807549ba06330ad197e5 to your computer and use it in GitHub Desktop.
Save welly87/d8e3c8a36e83807549ba06330ad197e5 to your computer and use it in GitHub Desktop.
https://github.com/welly87/spark-load
@welly87
Copy link
Author

welly87 commented Oct 1, 2020

!cd spark-load

@welly87
Copy link
Author

welly87 commented Oct 1, 2020

!apt-get install openjdk-8-jdk-headless -qq > /dev/null
!wget -q https://downloads.apache.org/spark/spark-2.4.7/spark-2.4.7-bin-hadoop2.7.tgz
!tar xf spark-2.4.7-bin-hadoop2.7.tgz

@welly87
Copy link
Author

welly87 commented Oct 1, 2020

!spark-2.4.7-bin-hadoop2.7/bin/spark-shell --driver-class-path mysql-connector-java-8.0.14.jar --jars mysql-connector-java-8.0.14.jar --packages org.apache.kudu:kudu-spark2_2.11:1.12.0 --master local[*] --conf spark.driver.bindAddress=127.0.0.1 --conf spark.driver.host=127.0.0.1 --conf spark.driver.port=7777

@welly87
Copy link
Author

welly87 commented Oct 1, 2020

@welly87
Copy link
Author

welly87 commented Oct 1, 2020

val sfmta_raw = spark.read.format("jdbc").option("url", "jdbc:mysql://relational.fit.cvut.cz/Student_loan?serverTimezone=UTC").option("dbtable", "person").option("user", "guest").option("password", "relational").load()

@welly87
Copy link
Author

welly87 commented Oct 1, 2020

  sfmta_raw.createOrReplaceTempView("person")
  var df = spark.sql(s"SELECT * FROM people")

@welly87
Copy link
Author

welly87 commented Oct 1, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment