Skip to content

Conversation

@vchan
Copy link
Contributor

@vchan vchan commented Dec 18, 2025

for Trino.

Delta Lake has two timestamp types: a time zone aware type TIMESTAMP and a time zone unaware type TIMESTAMPNTZ. These map to Trino's TIMESTAMP(3) WITH TIMEZONE and TIMESTAMP(6) respectively. See the Trino docs here. Therefore, SQLMesh will use one of those types for timestamps when generating Trino DDL statements with Delta Lake. Which one used depends on whether the column is time zone aware. This PR allows users to customize this mapping with the introduction of a timestamp_mapping map in the Trino engine adapter. Columns re-mapped this way will skip the automatic re-mapping done by SQLMesh mentioned above.

Hopefully the following example will help clarify my point. If you have a Trino model with a TIMESTAMP column, the table's column will be of type TIMESTAMP(6) because Trino's TIMESTAMP is time zone unaware. If you want the column to be TIMESTAMP(3) WITH TIMEZONE instead of TIMESTAMP(6), you can add this mapping to your Trino engine adapter config:

gateways:
  trino:
    connection:
      timestamp_mapping:
        TIMESTAMP(3): TIMESTAMP(3) WITH TIME ZONE

@vchan vchan marked this pull request as ready for review December 18, 2025 19:20
@vchan vchan force-pushed the vchan/trino-timestamp-type-mapping branch from cbd1b97 to c2f818e Compare December 18, 2025 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants