Generate Snowflake IDs and parse them back with Python.
ℹ️ This is a Python implementation of Twitter's Snowflake algorithm.
pip install py-snowflake-id
from snowflake import SnowflakeGenerator
# Create Snowflake instance
sf_gen = SnowflakeGenerator(
instance=0, # Instance iD
)
# Get next ID generated by Snowflake algorithm
next_sf_id = next(sf_gen)
Here is a list of useful resources for understanding this algorithm: