Skip to content

Commit

Permalink
added logger
Browse files Browse the repository at this point in the history
  • Loading branch information
manishsingh-rzp committed Jul 18, 2024
1 parent f5ae655 commit e0504a4
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ import com.razorpay.spark.jdbc.common.Constants
import org.apache.spark.sql.functions.{col, from_unixtime, lit, substring}
import org.apache.spark.sql.types.{IntegerType, LongType}
import org.apache.spark.sql.{DataFrame, SaveMode, SparkSession}
import org.slf4j.{Logger, LoggerFactory}

import scala.sys.process._
import java.util.Properties


/**
* Class that contains JDBC source, read parallelism params and target table name
*
Expand Down Expand Up @@ -81,6 +84,8 @@ class JDBCImport(
)(implicit val spark: SparkSession) {

import spark.implicits._
val logger: Logger = LoggerFactory.getLogger(this.getClass)


def createDbIfNotExists(outputDbName: String): Unit = {
val s3Bucket = Credentials.getSecretValue("SQOOP_S3_BUCKET")
Expand Down Expand Up @@ -161,11 +166,13 @@ class JDBCImport(
val driverType = DriverType.getJdbcDriver(dbType)
var dbTable = importConfig.jdbcQuery

logger.error(s"JDBC 1: jdbcUrl $buildJdbcUrl and dbTable $dbTable")

if (dbType == Constants.POSTGRESQL && schema.isDefined) {
dbTable = schema.get + "." + dbTable
}

println(s"print jdbcUrl $buildJdbcUrl and dbTable $dbTable")
logger.error(s"JDBC 2: jdbcUrl $buildJdbcUrl and dbTable $dbTable")

spark.read
.format("jdbc")
Expand Down

0 comments on commit e0504a4

Please sign in to comment.