LLL
LLL

Reputation: 469

Write Pyspark Dataframe to Hive table - name 'database' is not defined Error

I am trying to write a pyspark dataframe to a hive table with the following code on Jupyternotebook:

df.repartition("dt").write.partitionBy("dt").format("orc").saveAsTable(fraud_nr.test)

fraud_nr is the database I am trying to write the table to. But I got this error.

> NameError: name 'fraud_nr' is not defined

I would like to know what else I need to do to be able to write to this database.

Upvotes: 1

Views: 670

Answers (1)

notNull
notNull

Reputation: 31540

Keep db_name.table_name enclosed in quotes(")

df.repartition("dt").write.partitionBy("dt").format("orc").saveAsTable("fraud_nr.test")

Upvotes: 2

Related Questions