cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Write mode features in Bigquey using Databricks notebook.

Sumeet_Dora
New Contributor II

Currently using df.write.format("bigquery") ,Databricks only supports append and Overwrite modes in to writing Bigquery tables.Does Databricks has any option of executing the DMLs like Merge in to Bigquey using Databricks Notebooks.?

1 ACCEPTED SOLUTION

Accepted Solutions

mathan_pillai
Databricks Employee
Databricks Employee

@Sumeet Dora​ , Unfortunately there is no direct "merge into" option for writing to Bigquery using Databricks notebook. You could write to an intermediate delta table using the "merge into" option in delta table. Then read from the delta table and perform a full overwrite to the bigquery table, so that you get the up-to-date latest info in delta table and as well in bigquery. Hope it helps

You can refer to "merge into" option of delta table here https://docs.databricks.com/spark/latest/spark-sql/language-manual/delta-merge-into.html#merge-into-...

Here are some example notebooks for writing to bigquery

https://docs.databricks.com/data/data-sources/google/bigquery.html#example-notebooks

We have filter push down, but those are used while reading the data from bigquery. In the meanwhile, if I find any alternatives, I will post here.

View solution in original post

1 REPLY 1

mathan_pillai
Databricks Employee
Databricks Employee

@Sumeet Dora​ , Unfortunately there is no direct "merge into" option for writing to Bigquery using Databricks notebook. You could write to an intermediate delta table using the "merge into" option in delta table. Then read from the delta table and perform a full overwrite to the bigquery table, so that you get the up-to-date latest info in delta table and as well in bigquery. Hope it helps

You can refer to "merge into" option of delta table here https://docs.databricks.com/spark/latest/spark-sql/language-manual/delta-merge-into.html#merge-into-...

Here are some example notebooks for writing to bigquery

https://docs.databricks.com/data/data-sources/google/bigquery.html#example-notebooks

We have filter push down, but those are used while reading the data from bigquery. In the meanwhile, if I find any alternatives, I will post here.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group