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: 

Insert into query showing error

devdas
New Contributor III

Im trying to insert data from table with 7 columns to table with 37 columns

imageimage

1 ACCEPTED SOLUTION

Accepted Solutions

-werners-
Esteemed Contributor III

https://github.com/delta-io/delta/pull/1743

Spark 3.4 no longer requires users to provide all columns in insert-by-name queries.

Can you test with spark 3.4?

View solution in original post

11 REPLIES 11

-werners-
Esteemed Contributor III

If you define a column list for an insert, Databricks will assign the corresponding default value instead. If there is no default value defined, it will insert null.

However, if one of those columns is not nullable, an error is raised.

Can you check if Client_Name is nullable in the delta lake table?

devdas
New Contributor III

Thanks for the reply!

yes i did checked the client_name , all columns are nullable

image 

is there any way i can make client_name and remaining columns values as null ,if yes what is the query

-werners-
Esteemed Contributor III

afaik it should do that.

What version of databricks are you on?

devdas
New Contributor III

webapp_2023-06-03_03.32.06Z_master_

-werners-
Esteemed Contributor III

I mean databricks 11.3 etc. Can be seen on the cluster. Or databricks sql serverless etc

devdas
New Contributor III

11.3 LTS (includes Apache Spark 3.3.0, Scala 2.12)

-werners-
Esteemed Contributor III

well, should work... can you try without the column selection on WithoutDups delta table?

devdas
New Contributor III

image

-werners-
Esteemed Contributor III

https://github.com/delta-io/delta/pull/1743

Spark 3.4 no longer requires users to provide all columns in insert-by-name queries.

Can you test with spark 3.4?

Vartika
Moderator
Moderator

Hi @Ranjith Marakal​,

Thank you for posting your question in our community! We are happy to assist you.

To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?

This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance! 

irishplatinum
New Contributor II

Thanks for sharing, nice content. Irish Platinum

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!