DataStore Class Reference

See [I/O Operations](/docs/chdb/datastore/io) for details.

### Debugging Methods[​](#datastore-debug "Direct link to Debugging Methods")

|  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- |
| Method Description|  |  |  |  | | --- | --- | --- | --- | | `explain(verbose=False)` Show execution plan|  |  | | --- | --- | | `clear_cache()` Clear cached results | | | | | |

See [Debugging](/docs/chdb/debugging) for details.

### Magic Methods[​](#datastore-magic "Direct link to Magic Methods")

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Method Description|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | `__getitem__(key)` `ds['col']`, `ds[['a', 'b']]`, `ds[condition]`| `__setitem__(key, value)` `ds['col'] = value`| `__delitem__(key)` `del ds['col']`| `__len__()` `len(ds)`| `__iter__()` `for col in ds`| `__contains__(key)` `'col' in ds`| `__repr__()` `repr(ds)`| `__str__()` `str(ds)`| `__eq__(other)` `ds == other`| `__ne__(other)` `ds != other`| `__lt__(other)` `ds < other`| `__le__(other)` `ds <= other`| `__gt__(other)` `ds > other`| `__ge__(other)` `ds >= other`| `__add__(other)` `ds + other`| `__sub__(other)` `ds - other`| `__mul__(other)` `ds * other`| `__truediv__(other)` `ds / other`| `__floordiv__(other)` `ds // other`| `__mod__(other)` `ds % other`| `__pow__(other)` `ds ** other`| `__and__(other)` `ds & other`| `__or__(other)` `ds|  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | | `__invert__()` `~ds`| `__neg__()` `-ds`| `__pos__()` `+ds`| `__abs__()` `abs(ds)` | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

---

## ColumnExpr[​](#columnexpr "Direct link to ColumnExpr")

Represents a column expression for lazy evaluation. Returned when accessing a column.

```
# ColumnExpr is returned automatically
col = ds['name']  # Returns ColumnExpr
```

### Properties[​](#columnexpr-properties "Direct link to Properties")

|  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Property Type Description|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | `name` str Column name|  |  |  | | --- | --- | --- | | `dtype` dtype Data type | | | | | | | | |

### Accessors[​](#columnexpr-accessors "Direct link to Accessors")

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

See [Accessors](/docs/chdb/datastore/accessors) for complete documentation.

### Arithmetic Operations[​](#columnexpr-arithmetic "Direct link to Arithmetic Operations")

```
ds['total'] = ds['price'] * ds['quantity']
ds['profit'] = ds['revenue'] - ds['cost']
ds['ratio'] = ds['a'] / ds['b']
ds['squared'] = ds['value'] ** 2
ds['remainder'] = ds['value'] % 10
```

### Comparison Operations[​](#columnexpr-comparison "Direct link to Comparison Operations")

```
ds[ds['age'] > 25]           # Greater than
ds[ds['age'] >= 25]          # Greater or equal
ds[ds['age'] < 25]           # Less than
ds[ds['age'] <= 25]          # Less or equal
ds[ds['name'] == 'Alice']    # Equal
ds[ds['name'] != 'Bob']      # Not equal
```

### Logical Operations[​](#columnexpr-logical "Direct link to Logical Operations")

```
ds[(ds['age'] > 25) & (ds['city'] == 'NYC')]    # AND
ds[(ds['age'] > 25) | (ds['city'] == 'NYC')]    # OR
ds[~(ds['status'] == 'inactive')]               # NOT
```

### Methods[​](#columnexpr-methods "Direct link to Methods")