Skip to content

Instantly share code, notes, and snippets.

@ivansabik
Last active April 22, 2025 21:48
Show Gist options
  • Save ivansabik/d15421c0aa63ff244c28bd1f9f8d59ee to your computer and use it in GitHub Desktop.
Save ivansabik/d15421c0aa63ff244c28bd1f9f8d59ee to your computer and use it in GitHub Desktop.
Parse UNIX timestamp (epoch) with microsecond precision in Redshift (e.g. data generated by Debezium)
-- Replace hardcoded value with a column
-- Outputs 2025-04-21 18:14:26.308930
select DATEADD(
microsecond,
1745259266308930 % 1000000,
timestamp 'epoch' + (1745259266308930 / 1000000) * interval '1 second'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment