def getMysqlConn(url, driver, dbtable, user, password): print(" ############ inside getMysqlConn") df_dataset = sqlContext.read.format("jdbc").options( url=url, driver=driver, dbtable=dbtable, user=user, password=password).load() return df_dataset try: conf = SparkConf().setAppName("Spark_ETL") sc = SparkContext(conf=conf) sqlContext = HiveContext(sc) conf = ConfigParser.ConfigParser() conf.read("param.config") url = conf.get("MySQL", "url") driver = conf.get("MySQL", "driver") dbtable_A = conf.get("MySQL", "dbtable_A") dbtable_B = conf.get("MySQL", "dbtable_B") user = conf.get("MySQL", "user") password = conf.get("MySQL", "password") HiveSchema = conf.get("HiveSchema", "schema") print(url, driver, dbtable_A, dbtable_B, user, password) #check if we have received arguments as inputs to the script strWeek = sys.argv[1] if len(sys.argv) == 2 else "all_weeks" #logic to derive where clause based on input provided