Boolean Initials (T/F, Y/N)
representation.boolean.initialsBoolean value represented as a single initial character: T/F (true/false) or Y/N (yes/no), in any case. Transforms to DuckDB BOOLEAN type.
Worked samples
DuckDB 1.5.5 · finetype 0.6.64
| Value | As BOOLEAN |
|---|---|
| T | true |
| F | false |
| Y | true |
| N | false |
| t | true |
| f | false |
| y | true |
| n | false |
Background
Origin
The SQL:1999 standard introduced a BOOLEAN data type as an optional feature, numbered T031.[1] Wikipedia records that, as of 2012, few major SQL systems implemented the T031 feature.[1] MySQL treats BOOL and BOOLEAN as synonyms for TINYINT(1), with zero considered false and nonzero values true.[2] Before Oracle Database 23c, also branded 23ai, Oracle SQL had no native BOOLEAN type.[3]
PostgreSQL's boolean output function always emits either t or f.[4] PostgreSQL's boolean input accepts unique prefixes of true, yes, false and no, such as t or n, and ignores case.[4]
Use
Python's distutils.util.strtobool counted y and t among its true values and n and f among its false values, and raised ValueError for anything else.[5]
Sources
- [1]Boolean data type - Wikipediasecondary source
- [2]13.1.1 Numeric Data Type Syntaxdocumentation
- [3]SQL Boolean Type: How to Use It in All Major Relational Databasessecondary source
- [4]8.6. Boolean Typedocumentation
- [5]9. API Reference — Python 3.11.17 documentationdocumentation
Detection notes
Single-character boolean encoding. The model must distinguish these from categorical single-char columns (handled by boolean_set check in column classifier).
Use it
$ finetype infer -i "T" --mode column
→ representation.boolean.initials
SELECT ft_infer('T');
-- → 'representation.boolean.initials'CAST({col} AS BOOLEAN)Schema
https://meridian.online/schemas/representation.boolean.initials · Frictionless type boolean
finetype taxonomy representation.boolean.initials -o json-schema