How can I write data to hive with jdbc

2021-08-10 Thread igyu
var cfg:Map[String,String] = Map() cfg += ("url"->"jdbc:hive2://tidb4ser:11000/joinwarehouse;user=jztwk;password=123456;hive.server2.proxy.user=jztwk") cfg += ("dbtable"->"ods_job_log") cfg += ("user"->"jztwk") cfg += ("passwrod"-> "123456") cfg += ("driver"-> "org.apache.h

Re: How can I write data to hive with jdbc

2021-08-04 Thread Mich Talebzadeh
Actually if read from that table you can just do val tableName = "joinwarehouse.ods_job_log" option("dbtable", tableName) Also I made a typo in the url. val url = "jdbc:hive2://tidb4ser:11000/default" Just put default there for the database name. HTH view my Linkedin profile

Re: How can I write data to hive with jdbc

2021-08-04 Thread Mich Talebzadeh
Caused by: org.apache.spark.sql.catalyst.analysis.NoSuchTableException: Table or view 'ods_job_log' not found in database 'default'; Where is your table? It is looking at *default database* In general this is the format read_df = spark.read. \ format("jdbc"). \

How can I write data to hive with jdbc

2021-08-04 Thread igyu
var cfg:Map[String,String] = Map() cfg += ("url"->"jdbc:hive2://tidb4ser:11000/joinwarehouse;user=jztwk;password=123456;hive.server2.proxy.user=jztwk") cfg += ("dbtable"->"ods_job_log") cfg += ("user"->"jztwk") cfg += ("passwrod"-> "123456") cfg += ("driver"-> "org.apache.h

Re: How can I write data to hive with jdbc

2021-07-30 Thread Mich Talebzadeh
This is a generic JDBC write to a DB from Pyspark def writeTableWithJDBC(dataFrame, url, tableName, user, password, driver, mode): try: dataFrame. \ write. \ format("jdbc"). \ option("url", url). \ option("dbtable", tableName). \

How can I write data to hive with jdbc

2021-07-30 Thread igyu
val DF = sparkSession.read.format("jdbc") .option("url", "jdbc:hive2://tidb4ser:11000/hivetest;hive.server2.proxy.user=jztwk") .option("dbtable", "(SELECT * FROM tb_user where created=1602864000) as tmp") .option("user", "admin") .option("password", "00") .option("fetchsize", "2000")