Shape / columns · All operations

Make a slug

A variant of Clean up text

Turn text into a lowercase identifier with no spaces or punctuation, fit for a URL or a column name.

Status

In arcform

Runs as a SQL step

arcform carries it as a sql: step today.

The DuckDB step

Turn text into a lowercase slug

SQL
CREATE TEMP TABLE raw AS SELECT * FROM (VALUES
  (1, 'Café Déjà vu: 2026 Edition!'), (2, '  Bob   Okafor  '), (3, 'Carla Díaz')
) t(id, title);
CREATE TEMP TABLE result AS
SELECT id, trim(regexp_replace(lower(strip_accents(title)), '[^a-z0-9]+', '-', 'g'), '-') AS slug FROM raw;
SELECT * FROM result ORDER BY id;
SELECT CASE WHEN ((SELECT list(slug ORDER BY id) FROM result) = ['cafe-deja-vu-2026-edition', 'bob-okafor', 'carla-diaz']) THEN 'as expected' ELSE error('the three titles did not become lowercase slugs of letters, digits and single hyphens') END AS verdict;
  • The statement builds its own data.
  • It needs nothing installed beyond DuckDB itself.
  • The statement checks its own result and raises an error when it is wrong: “the three titles did not become lowercase slugs of letters, digits and single hyphens”.
  • It passed on DuckDB v2.0.0 (Cyanoptera) d54cbbe3df.

What other tools call it

Meridian's classification; an independent blind rating agreed on 95.7% of 324 rows (variant, version 3).

Bruin (1)
dbt-utils (1)
  • slugifyread 2026-09-27

    Turn a Jinja string into a lowercase underscore slug usable as a column name

Duckle (1)
  • Slugread 2026-09-25

    URL-safe slug: lowercase, hyphens, no punctuation

Background

A URL slug is usually the end part of a URL, often described as the part that identifies a page in human-readable keywords.[1] Slugs may be entirely lowercase, with accented letters replaced by Latin ones and whitespace by a hyphen or an underscore to avoid being encoded.[1] Punctuation marks are generally removed from slugs, and some generators also remove short, common words such as conjunctions.[1]

When to use it

Slugs are typically generated automatically from a page title, so the title stays designed for display while the slug can be optimised for brevity.[1] Long page titles may also be truncated to keep a URL to a reasonable length.[1] The dbt_utils slugify macro turns the payment methods venmo App, ca$h-money and 1337pay into venmo_app, cah_money and _1337pay.[2] Bruin's slugify helper converts text into a lowercase SQL-friendly identifier, rendering 9 Active Users! as _9_active_users.[3] Choose the separator by destination: hyphens for a URL, underscores for a column name. (Meridian's view)

Check a slug column for duplicates before using it as a key. (Meridian's view)

The method

Django's slugify converts a string to ASCII by default, lowercases it, removes characters that are not alphanumerics, underscores, hyphens or whitespace, and turns whitespace or repeated dashes into single dashes.[4] Django's slugify also removes leading and trailing whitespace, dashes and underscores, so a value with spaces at both ends, Joel is a slug, becomes joel-is-a-slug.[4] With allow_unicode set, Django's slugify keeps non-ASCII letters, turning 你好 World into 你好-world.[4] The name slug comes from the news media's use of the word for a short name given to an article for internal use.[1]

Sources

  1. [1]Clean URL - Wikipediasecondary source
  2. [2]README.mddocumentation
  3. [3]Macros | Bruin CLIdocumentation
  4. [4]Django Utils | Django documentation | Djangodocumentation