title_wip

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/chdb/datastore/accessors.md)

DataStore provides 7 accessor namespaces with 185+ methods for domain-specific operations.

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Accessor Methods Description|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `.str` 56 String operations|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `.dt` 42+ DateTime operations|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `.arr` 37 Array operations (ClickHouse-specific)|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `.json` 13 JSON parsing (ClickHouse-specific)|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `.url` 15 URL parsing (ClickHouse-specific)|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `.ip` 9 IP address operations (ClickHouse-specific)|  |  |  | | --- | --- | --- | | `.geo` 14 Geo/distance operations (ClickHouse-specific) | | | | | | | | | | | | | | | | | | | | | | | |

---

## String Accessor (`.str`)[​](#str "Direct link to str")

All 56 pandas `.str` methods are supported, plus ClickHouse string functions.

### Case Conversion[​](#str-case "Direct link to Case Conversion")

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `upper()` `upper()` Convert to uppercase|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `lower()` `lower()` Convert to lowercase|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `capitalize()` `initcap()` Capitalize first letter|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `title()` `initcap()` Title case|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `swapcase()` - Swap case|  |  |  | | --- | --- | --- | | `casefold()` `lower()` Case folding | | | | | | | | | | | | | | | | | | | | |

```
ds['name_upper'] = ds['name'].str.upper()
ds['name_title'] = ds['name'].str.title()
```

### Length and Size[​](#str-length "Direct link to Length and Size")

|  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `len()` `length()` String length (bytes)|  |  |  | | --- | --- | --- | | `char_length()` `char_length()` Length in characters | | | | | | | | |

```
ds['name_len'] = ds['name'].str.len()
```

### Substring and Slicing[​](#str-substring "Direct link to Substring and Slicing")

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `slice(start, stop)` `substring()` Extract substring|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `slice_replace()` - Replace slice|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `left(n)` `left()` Leftmost n characters|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `right(n)` `right()` Rightmost n characters|  |  |  | | --- | --- | --- | | `get(i)` - Character at index | | | | | | | | | | | | | | | | | |

```
ds['first_3'] = ds['name'].str.slice(0, 3)
ds['last_4'] = ds['name'].str.right(4)
```

### Trimming[​](#str-trim "Direct link to Trimming")

|  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `strip()` `trim()` Remove whitespace|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `lstrip()` `trimLeft()` Remove leading whitespace|  |  |  | | --- | --- | --- | | `rstrip()` `trimRight()` Remove trailing whitespace | | | | | | | | | | | |

```
ds['trimmed'] = ds['text'].str.strip()
```

### Search and Match[​](#str-search "Direct link to Search and Match")

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method ClickHouse Description|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `contains(pat)` `position()` Contains substring|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `startswith(pat)` `startsWith()` Starts with prefix|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `endswith(pat)` `endsWith()` Ends with suffix|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `find(sub)` `position()` Find position|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `rfind(sub)` - Find from right|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `index(sub)` `position()` Find or raise|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `rindex(sub)` - Find from right or raise|  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `match(pat)` `match()` Regex match|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `fullmatch(pat)` - Full regex match|  |  |  | | --- | --- | --- | | `count(pat)` - Count occurrences | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

```
# Contains substring
ds['has_john'] = ds['name'].str.contains('John')

# Regex match
ds['valid_email'] = ds['email'].str.match(r'^[\w.-]+@[\w.-]+\.\w+$')
```

### Replace[​](#str-replace "Direct link to Replace")