Created
May 11, 2020 23:25
-
-
Save chetkhatri/94c86f1b0fd3666f1f139d391e803fcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.example.core.common.ConfigLoader | |
import com.example.core.common.DeltaWriter._ | |
object Demo extends App { | |
if (args.length < 2) { | |
logger.error("No Environment type or Network ID are provided as a argument while running spark job") | |
System.exit(1) | |
} | |
val envType = args(0) | |
val NETWORK_ID = Some(args(1)) | |
val CLIENT_SCHEMA = Some(args(2)) | |
val APP_NAME: String = s"Demo-${NETWORK_ID.get}" | |
val spark = getSparkSession(APP_NAME) | |
val configUtility = new ConfigLoader(envType, NETWORK_ID.get.toInt, CLIENT_SCHEMA.get) | |
val tableList = List( | |
"EXAMPLE_EXCHANGE_RATE_DAILY", | |
"EXAMPLE_SETTING", | |
"EXAMPLE_HISTORY", | |
"EXAMPLE" | |
) | |
tableList.foreach(t => deltaTableWriteToSQLServer( | |
spark, envType, NETWORK_ID.get.toInt, configUtility.CONSUMABLE_DATA, | |
CLIENT_SCHEMA.get, t | |
)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment