Skip to content

Commit 280c950

Browse files
committed
Update docs
1 parent d7a4ce8 commit 280c950

5 files changed

Lines changed: 27 additions & 33 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ To use DuckDB or SQLite as the backend:
1616
$ pip install chronify
1717
```
1818

19-
To use Apache Spark via Apache Thrift Server as the backend:
19+
To use Apache Spark as the backend:
2020
```
2121
$ pip install "chronify[spark]"
2222
```

docs/how_tos/getting_started/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ To use DuckDB or SQLite as the backend:
3737
$ pip install chronify
3838
```
3939

40-
To use Apache Spark via Apache Thrift Server as the backend, you must install pyhive.
41-
This command will install the necessary dependencies.
40+
To use Apache Spark as the backend, install chronify with the ``spark`` extra,
41+
which pulls in PySpark:
4242

4343
```{eval-rst}
4444
.. code-block:: console

docs/how_tos/ingest_multiple_tables.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# How to Ingest Multiple Tables Efficiently
22

33
There are a few important considerations when ingesting many tables:
4-
- Use one database connection.
54
- Avoid loading all tables into memory at once, if possible.
65
- Ensure additions are atomic. If anything fails, the final state should be the same as the initial
76
state.
@@ -48,25 +47,23 @@ dst_schema = TableSchema(
4847
Chronify will manage the database connection and errors.
4948
```python
5049
store.ingest_from_csvs(
51-
src_schema,
52-
dst_schema,
5350
(
5451
"/path/to/file1.csv",
5552
"/path/to/file2.csv",
5653
"/path/to/file3.csv",
5754
),
58-
)
55+
src_schema,
56+
dst_schema,
57+
)
5958

6059
```
6160

6261
## Self-Managed
63-
Open one connection to the database for the duration of your additions. Handle errors.
62+
Wrap the additions in a backend transaction. Any tables or views created within the block are
63+
automatically dropped if an exception is raised.
6464
```python
65-
with store.engine.connect() as conn:
66-
try:
67-
store.ingest_from_csv(src_schema, dst_schema, "/path/to/file1.csv")
68-
store.ingest_from_csv(src_schema, dst_schema, "/path/to/file2.csv")
69-
store.ingest_from_csv(src_schema, dst_schema, "/path/to/file3.csv")
70-
except Exception:
71-
conn.rollback()
65+
with store.backend.transaction():
66+
store.ingest_from_csv("/path/to/file1.csv", src_schema, dst_schema)
67+
store.ingest_from_csv("/path/to/file2.csv", src_schema, dst_schema)
68+
store.ingest_from_csv("/path/to/file3.csv", src_schema, dst_schema)
7269
```

docs/how_tos/spark_backend.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,18 @@ schema = TableSchema(
6262

6363
```python
6464
from chronify import Store
65+
from chronify.ibis.spark_backend import SparkBackend
6566

66-
store = Store.create_new_hive_store("hive://localhost:10000/default")
67-
store.create_view_from_parquet("data.parquet")
67+
store = Store(backend=SparkBackend())
68+
store.create_view_from_parquet("data.parquet", schema)
69+
```
70+
71+
Alternatively, pass a pre-configured PySpark session:
72+
```python
73+
from pyspark.sql import SparkSession
74+
75+
session = SparkSession.builder.master("local").getOrCreate()
76+
store = Store(backend=SparkBackend(session=session))
6877
```
6978

7079
Verify the data:

docs/index.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This package implements validation, mapping, and storage of time series data in
44
Python-based modeling packages.
55

66
## Features
7-
- Stores time series data in any database supported by SQLAlchemy.
7+
- Stores time series data in any database supported by Ibis (DuckDB, SQLite, and Spark).
88
- Supports data ingestion in a variety of file formats and configurations.
99
- Supports efficient retrieval of time series through SQL queries.
1010
- Validates consistency of timestamps and resolution.
@@ -23,24 +23,12 @@ Python-based modeling packages.
2323
```
2424

2525
## Supported Backends
26-
While chronify should work with any database supported by SQLAlchemy, it has been tested with
27-
the following:
26+
Chronify uses [Ibis](https://ibis-project.org) for all database operations. The following
27+
backends are supported:
2828

2929
- DuckDB (default)
3030
- SQLite
31-
- Apache Spark through Apache Thrift Server
32-
33-
DuckDB and SQLite are fully supported.
34-
35-
Because of limitations in the backend software, chronify functionality with Spark is limited to
36-
the following:
37-
38-
- Create a view into an existing Parquet file (or directory).
39-
- Perform time series checks.
40-
- Map between time configurations.
41-
- Write output data to Parquet files.
42-
43-
There is no support for creating tables and ingesting data with Spark.
31+
- Apache Spark (via PySpark)
4432

4533
## How to use this guide
4634
- Refer to [How Tos](#how-tos-page) for step-by-step instructions for creating store and ingesting data.

0 commit comments

Comments
 (0)