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:ย 

CONVERT_TIMEZONE issue in DLT

SamGreene
Contributor

I can run a query that uses the CONVERT_TIMEZONE function in a SQL notebook.  When I move the code to my DLT notebook the pipeline produces this error:

Cannot resolve function `CONVERT_TIMEZONE`

Here is the line:  CONVERT_TIMEZONE('UTC', 'America/Phoenix', date_time) as local_datetime

Should this work?

 

5 REPLIES 5

SamGreene
Contributor

Can anyone replicate this?  Thanks. 

annn
New Contributor II

I'm having this exact same issue. @SamGreene did you ever find a resolution to this?

Danny_Lee
Valued Contributor

Have you added

%sql

magic command?

Also, did you SELECT the CONVERT_TIMEZONE?  

> SELECT convert_timezone('America/Los_Angeles', 'UTC', timestamp_ntz'2021-12-06 00:00:00');
2021-12-06 08:00:00

-- Current session local timezone: UTC
> SELECT convert_timezone('America/Los_Angeles', timestamp_ntz'2021-12-06 08:00:00');;
2021-12-06 00:00:00

From docs: https://docs.databricks.com/en/sql/language-manual/functions/convert_timezone.html

--
The heart that breaks open can contain the whole universe. - Joanna Macy

Yes, Danny, this is in an otherwise functional DLT SQL notebook.  It happens when I add the function around an existing column being selected. 

annn
New Contributor II

Yes, the notebook is set to SQL and the convert_timezone function is within a select statement.

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