Skip to content

Read and Write dataframe to MySQL DB. [UnitTests] [CodeCoverage] [Scala] [Spark] [gradle]

Notifications You must be signed in to change notification settings

mjaglan/SparkDFReadWrite

Repository files navigation

A demo project which will Read and Write a dataframe to MySQL DB.


Build System (Gradle)

------------------------------------------------------------
Essential tasks runnable from root project
------------------------------------------------------------

Build tasks
-----------
build - Assembles and tests this project.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.

Help tasks
----------
tasks - Displays the tasks runnable from root project 'SparkReadWriteDF'.

IDE tasks
---------
cleanEclipse - Cleans all Eclipse files.
eclipse - Generates all Eclipse files.

Verification tasks
------------------
check - Runs all checks.
test - Runs the unit tests.

Other tasks
-----------
checkScoverage
jarScoverage



Input Resources



How to run?

  • Install Gradle 2.14 Build Tool (click here for reference)

  • For eclipse, install Buildship 1.0.16 Plugin for Gradle 2.14 (click here for reference)

    NOTE: Installing Gradle 3.0 or above will give following error

    No such property: useAnt for class: org.gradle.api.tasks.scala.ScalaCompileOptions

    This is because useAnt support is removed from Gradle 3.0 onwards. So prefer sticiking to 2.14 version.

  • Setup MySQL server as mentioned below separately

  • Run any of the above mentioned gradle tasks, for example, run any one of the following line -

    gradle build
    
    gradle test
    
    gradle checkScoverage



How to setup MYSQL DB?

  • Install MySQL (for example like this)
  • Login To Root
  • Create a new user (like this)
  • Create a database (like this)
  • Create a simple SQL table (like this)
  • Update following JSON file with MySQL login details: dbArgs.json



Scala Unit Tests (ScalaTest Tool)

Scala Unit Testing Report The above shown unit testing report is present at location build/reports/tests/




Scala Code Coverage (SCoverage Tool)

Scala Code Coverage Report The above shown code coverage report is present at location build/reports/scoverage/




About

Read and Write dataframe to MySQL DB. [UnitTests] [CodeCoverage] [Scala] [Spark] [gradle]

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published