Save dataframe to a schema/database.table (in HBase) using Phoenix (by Scala)

Viewed 34

I successfully save dataframe to HBase table (with no schema) using Phoenix with this code:

df_user.write
  .format("org.apache.phoenix.spark")
  .mode(SaveMode.Overwrite)
  .option("table", "table_name")
  .option("zkUrl", hbaseZkUrl)
  .save()

(More guide here: https://phoenix.apache.org/phoenix_spark.html)

But my table is contained in a schema/database (format: schema_name.table_name). So, we do not find any solution to save in this table.

I have tried the below code but failed:

df_user.write
  .format("org.apache.phoenix.spark")
  .mode(SaveMode.Overwrite)
  .option("table", "schema_name.table_name")
  .option("zkUrl", hbaseZkUrl)
  .save()
df_user.write
  .format("org.apache.phoenix.spark")
  .mode(SaveMode.Overwrite)
  .schema("schema_name")
  .option("table", "table_name")
  .option("zkUrl", hbaseZkUrl)
  .save()

Does anyone have a solution for my problem? Many thanks!

0 Answers
Related