cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to capture the Query result via JDBC client execution

inagar
New Contributor
As shown in below screenshots MERGE INTO command produces information about the result (num_affected_rows, num_updated_rows, num_deleted_rows, num_inserted_rows).
Unable to get this information when the same query is being executed via JDBC client. Is there a way to read this information via the JDBC client ?
 
Using below databricks maven dependency
<dependency>
<groupId>com.databricks</groupId>
<artifactId>databricks-jdbc</artifactId>
<version>2.6.36</version></dependency>

Screenshot 2024-06-26 at 1.30.19 AM.pngScreenshot 2024-06-26 at 1.36.10 AM (1).png

Only The Affected rows information can be obtained as shown below.

Screenshot 2024-06-26 at 1.45.23 AM.png

2 REPLIES 2

Kaniz_Fatma
Community Manager
Community Manager

Hi @inagar

  • Instead of relying solely on the JDBC client’s default behavior, you can execute a custom SQL query that combines the MERGE INTO statement with additional queries to retrieve the desired information.
  • For instance, you can execute a separate SELECT statement to fetch the counts of updated, deleted, and inserted rows based on your business logic.

Rishabh_Tiwari
Community Manager
Community Manager

Hi @inagar ,

Thank you for reaching out to our community! We're here to help you. 

To ensure we provide you with the best support, could you please take a moment to review the response and choose the one that best answers your question? Your feedback not only helps us assist you better but also benefits other community members who may have similar questions in the future.

If you found the answer helpful, consider giving it a kudo. If the response fully addresses your question, please mark it as the accepted solution. This will help us close the thread and ensure your question is resolved.

We appreciate your participation and are here to assist you further if you need it!

Thanks,

Rishabh

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