daft.functions.uuid#
uuid #
uuid(version: Literal['v4', 'v7'] = 'v4') -> Expression
Generates a column of UUID strings.
Each call to uuid() generates a fresh UUID per row. Multiple calls in the same query (e.g. two separate columns) are independent and will produce different values.
Use the version argument to choose the UUID version:
uuid()oruuid(version="v4")generates random UUIDv4 values.uuid(version="v7")generates time-ordered UUIDv7 values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version | Literal['v4', 'v7'] | UUID version to generate. Supported values are | 'v4' |
Returns:
| Name | Type | Description |
|---|---|---|
Expression | UUID Expression | An expression that generates UUID values. |
Examples:
1 2 3 4 | |
╭────────────────────────────────┬────────────────────────────────╮
│ uuid_v4 ┆ uuid_v7 │
│ --- ┆ --- │
│ UUID ┆ UUID │
╞════════════════════════════════╪════════════════════════════════╡
│ 06b4460f-d44e-4f37-bb71-edb3b… ┆ 019eb73f-58c8-7f50-b31d-46f02… │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 74648614-aebf-41f3-9591-781d5… ┆ 019eb73f-58c8-7f50-b31d-47002… │
╰────────────────────────────────┴────────────────────────────────╯
(Showing first 2 of 2 rows) Source code in daft/functions/misc.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |