Metadata-Version: 2.4
Name: sqlite-utils-sqlite-dateutil
Version: 0.1a0
Summary: sqlite-utils plugin that loads the sqlite-dateutil SQLite extension
Author: Simon Willison
License-Expression: Apache-2.0
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/simonw/sqlite-dateutil
Project-URL: Issues, https://github.com/simonw/sqlite-dateutil/issues
Project-URL: Changelog, https://github.com/simonw/sqlite-dateutil/releases
Project-URL: CI, https://github.com/simonw/sqlite-dateutil/actions
Requires-Dist: sqlite-utils
Requires-Dist: sqlite-dateutil==0.1a0
Description-Content-Type: text/markdown

# sqlite-utils-sqlite-dateutil

sqlite-utils plugin that loads the sqlite-dateutil SQLite extension. [sqlite-dateutil](https://github.com/simonw/sqlite-dateutil) is a C port of [python-dateutil](https://github.com/dateutil/dateutil)'s `parser.parse()`, about 38x faster than calling dateutil from Python.

## Installation

```bash
sqlite-utils install sqlite-utils-sqlite-dateutil
```

## Usage

Once installed, the functions are available to `sqlite-utils query` and `sqlite-utils memory`:

```bash
sqlite-utils memory "select dateutil_parse_fuzzy('Today is January 1, 2047 at 8:21:00AM') as d"
# [{"d": "2047-01-01T08:21:00"}]
```

They are also available to Python code that uses `sqlite_utils.Database()`.

Each function returns an ISO 8601 string, or `NULL` where dateutil would raise an exception:

| SQL function | Python equivalent |
| --- | --- |
| `dateutil_parse(text)` | `parse(text).isoformat()` |
| `dateutil_parse_fuzzy(text)` | `parse(text, fuzzy=True).isoformat()` |
| `dateutil_parse_dayfirst(text)` | `parse(text, dayfirst=True).isoformat()` |
| `dateutil_parse_fuzzy_dayfirst(text)` | `parse(text, fuzzy=True, dayfirst=True).isoformat()` |

See the [sqlite-dateutil documentation](https://github.com/simonw/sqlite-dateutil) for details and the known differences from dateutil.
