cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Using built-in SQL functions in Delta Live tables

colt
New Contributor III

Do Delta Live Tables have different built-in SQL functions than the corresponding Databricks runtime?

I created a cluster with Databricks runtime 10.3 (the current DLT runtime) so I could test my Delta Live Tables code before running it as a pipeline. I was able to use the built-in SQL functions split() and element_at() within my interactive workbook, but then when I tried to use them in a DLT run, the same code produced a null value.

Is there a reference guide for Delta Live Tables that shows the built-in functions (if different from the corresponding Databricks runtime built-in functions)?

The code I ran was to split a file path to extract just the file name. It took a string like this:

"s3://example-bucket/folder/secondfolder/thirdfolder/b4618a0e-ffb8-11ec-9bbe-00163e43d8f1.json"

and extracted this:

"b4618a0e-ffb8-11ec-9bbe-00163e43d8f1"

Here's the code, which works fine in interactive 10.3 runtime, but doesn't work in DLT:

spark.sql("""

SELECT 

element_at(split(element_at(split(file_name, '/'), -1), '\\.'), 1) as file_guid,

*

FROM my_tablename""")

3 REPLIES 3

Kaniz
Community Manager
Community Manager

Hi @Colt Kesselring​, This guide will demonstrate how Delta Live Tables enables you to develop scalable, reliable data pipelines that conform to the data quality standards of a Lakehouse architecture.

Vidula
Honored Contributor

Hi @Colt Kesselring​ 

Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help. 

We'd love to hear from you.

Thanks!

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.