You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add strip_accents option to inflect() for diacritics removal
Adds a strip_accents option to all three inflect() variants (table function,
scalar string, scalar struct) that removes diacritical marks before applying
case transformations. Uses DuckDB's bundled utf8proc for accent stripping.
Default behavior preserves accents for backward compatibility.
Closes#4
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
-**Snake, kebab, screaming_snake** output is unaffected since those styles don't use mixed case
388
391
-**Thread-safe**: Acronym configuration uses a read-write lock for concurrent access
389
392
393
+
## Accent Stripping
394
+
395
+
By default, accented characters (é, ü, ñ, etc.) are preserved as-is during case transformations. When working with data that contains diacritics—such as French column names—you may want fully normalized ASCII output. Use the `strip_accents` option to remove diacritical marks before applying the case transformation.
396
+
397
+
### Scalar String
398
+
399
+
Pass `true` as the third argument:
400
+
401
+
```sql
402
+
SELECT inflect('snake', 'Libellé civilité', true) as v;
403
+
┌──────────────────┐
404
+
│ v │
405
+
│ varchar │
406
+
├──────────────────┤
407
+
│ libelle_civilite │
408
+
└──────────────────┘
409
+
```
410
+
411
+
### Scalar Struct
412
+
413
+
Field names are stripped of accents:
414
+
415
+
```sql
416
+
SELECT inflect('snake', {"Libellé": 1, "civilité": 2}, true) as v;
Without `strip_accents` (or with `false`), accents are preserved—this is fully backward compatible:
442
+
443
+
```sql
444
+
SELECT inflect('snake', 'Libellé civilité') as v;
445
+
┌──────────────────────┐
446
+
│ v │
447
+
│ varchar │
448
+
├──────────────────────┤
449
+
│ libellé_civilité │
450
+
└──────────────────────┘
451
+
```
452
+
390
453
## Advanced Usage
391
454
392
455
### Nested Struct Transformation
@@ -466,6 +529,10 @@ A: Yes, `table_case` converts to snake_case and pluralizes the name (e.g., `User
466
529
467
530
A: Yes! You can nest `inflect()` calls or pipe results through multiple transformations.
468
531
532
+
**Q: How do I handle accented/diacritical column names?**
533
+
534
+
A: Use the `strip_accents` option to remove diacritics before case conversion. For scalar calls, pass `true` as the third argument: `inflect('snake', 'Libellé', true)`. For the table function, use the named parameter: `FROM inflect('snake', (SELECT ...), strip_accents := true)`.
535
+
469
536
## Contributing
470
537
471
538
The Inflector extension is open source and developed by [Query.Farm](https://query.farm).
0 commit comments