Showing results for 
Search instead for 
Did you mean: 
Community 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.
Showing results for 
Search instead for 
Did you mean: 

Maintaining Order Consistency: Table Creation in Databricks SQL vs. DLT Pipeline

New Contributor

I have a CTE table with the below names as values. My objective is to create another table by concatenating all the rows from the CTE table in ascending order, resulting in the final output sequence: "Abi, Rahul, ram, Siva". When executing the query in DataBricks SQL, the expected outcome is achieved. However, when creating the table through the DLT pipeline, the order is altered, resulting in the following sequence: "Abi, Siva, ram, Rahul". Is there a solution to maintain the original order consistently, regardless of whether the table is created manually or through the DLT pipeline?



Esteemed Contributor III

when writing, order is not guaranteed due to the nature of distributed processing.
If you want the order to be guaranteed, you should order it when reading the data.

Your query does not write any data, DLT does, that is the difference.

New Contributor III

Hi @Archana_Mathan, did you solve this problem by any chance? I am having a similar problem maintaining the order of the dlt.

Thank you,

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!