MeridianMERIDIAN

Snowflake ID

Twitter/Discord-style snowflake identifier. A 17-20 digit integer encoding a millisecond timestamp, worker ID, and sequence number.

Snowflake ID

technology.identifier.snowflake_id

Twitter/Discord-style snowflake identifier. A 17-20 digit integer encoding a millisecond timestamp, worker ID, and sequence number.

Domain
technology
Category
identifier
Casts to
BIGINT
Scope
Universal

Try it

CLI
$ finetype infer -i "175928847299117063"
→ technology.identifier.snowflake_id

DuckDB

Detect
SELECT finetype('175928847299117063');
-- → 'technology.identifier.snowflake_id'
Cast expression
epoch_ms(({col}::BIGINT >> 22) + 1288834974657)
Safe cast pipeline
-- Normalise and cast in one step
SELECT TRY_CAST(finetype_cast(my_column) AS BIGINT) AS clean_value
FROM my_table
WHERE finetype(my_column) = 'technology.identifier.snowflake_id';

Struct Expansion

Expression
sequence: {col}::BIGINT & 4095
timestamp_ms: ({col}::BIGINT >> 22) + 1288834974657
worker_id: ({col}::BIGINT >> 12) & 1023

JSON Schema

finetype schema technology.identifier.snowflake_id
{
  "$id": "https://meridian.online/schemas/technology.identifier.snowflake_id",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Twitter/Discord-style snowflake identifier. A 17-20 digit integer encoding a millisecond timestamp, worker ID, and sequence number.",
  "examples": [
    "175928847299117063",
    "1234567890123456789",
    "80351110224678912"
  ],
  "pattern": "^\\d{17,20}$",
  "title": "Snowflake ID",
  "type": "string",
  "x-finetype-broad-type": "BIGINT",
  "x-finetype-transform": "epoch_ms(({col}::BIGINT >> 22) + 1288834974657)"
}

Examples

175928847299117063123456789012345678980351110224678912

Aliases

twitter_iddiscord_id

Type Registry