pandas-arango 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pandas_arango-0.1.2/LICENSE +21 -0
- pandas_arango-0.1.2/PKG-INFO +166 -0
- pandas_arango-0.1.2/README.md +110 -0
- pandas_arango-0.1.2/pandas_arango/__init__.py +13 -0
- pandas_arango-0.1.2/pandas_arango/errors.py +1 -0
- pandas_arango-0.1.2/pandas_arango/normalize.py +1 -0
- pandas_arango-0.1.2/pandas_arango/py.typed +1 -0
- pandas_arango-0.1.2/pandas_arango/read.py +475 -0
- pandas_arango-0.1.2/pandas_arango/typing.py +1 -0
- pandas_arango-0.1.2/pandas_arango/write.py +531 -0
- pandas_arango-0.1.2/pandas_arango.egg-info/PKG-INFO +166 -0
- pandas_arango-0.1.2/pandas_arango.egg-info/SOURCES.txt +18 -0
- pandas_arango-0.1.2/pandas_arango.egg-info/dependency_links.txt +1 -0
- pandas_arango-0.1.2/pandas_arango.egg-info/requires.txt +18 -0
- pandas_arango-0.1.2/pandas_arango.egg-info/top_level.txt +1 -0
- pandas_arango-0.1.2/pyproject.toml +82 -0
- pandas_arango-0.1.2/setup.cfg +4 -0
- pandas_arango-0.1.2/tests/test_read.py +591 -0
- pandas_arango-0.1.2/tests/test_round_trip.py +33 -0
- pandas_arango-0.1.2/tests/test_write.py +628 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alex Petenchea
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pandas-arango
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A connector between ArangoDB and pandas DataFrames
|
|
5
|
+
Author-email: Alexandru Petenchea <alex.petenchea@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Alex Petenchea
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Repository, https://github.com/apetenchea/pandas-arango
|
|
29
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Operating System :: OS Independent
|
|
32
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
37
|
+
Classifier: Typing :: Typed
|
|
38
|
+
Requires-Python: >=3.11
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
License-File: LICENSE
|
|
41
|
+
Requires-Dist: pandas>=2.2
|
|
42
|
+
Requires-Dist: python-arango>=8.0
|
|
43
|
+
Provides-Extra: example
|
|
44
|
+
Requires-Dist: matplotlib>=3.10; extra == "example"
|
|
45
|
+
Provides-Extra: test
|
|
46
|
+
Requires-Dist: pytest>=8.0; extra == "test"
|
|
47
|
+
Provides-Extra: docs
|
|
48
|
+
Requires-Dist: sphinx==8.2.3; extra == "docs"
|
|
49
|
+
Requires-Dist: sphinx-rtd-theme==3.0.2; extra == "docs"
|
|
50
|
+
Provides-Extra: dev
|
|
51
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
52
|
+
Requires-Dist: pre-commit>=4.0; extra == "dev"
|
|
53
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
54
|
+
Requires-Dist: ruff>=0.9; extra == "dev"
|
|
55
|
+
Dynamic: license-file
|
|
56
|
+
|
|
57
|
+
# pandas-arango
|
|
58
|
+
|
|
59
|
+
`pandas-arango` is a synchronous connector for moving data between ArangoDB
|
|
60
|
+
documents and pandas DataFrames. It supports AQL and collection reads, chunked
|
|
61
|
+
results, and batched insert, update, replace, and upsert operations.
|
|
62
|
+
|
|
63
|
+
## Requirements
|
|
64
|
+
|
|
65
|
+
- Python 3.11 or newer
|
|
66
|
+
- pandas 2.2 or newer
|
|
67
|
+
- python-arango 8.0 or newer
|
|
68
|
+
- A running ArangoDB server
|
|
69
|
+
|
|
70
|
+
Install it with:
|
|
71
|
+
|
|
72
|
+
```console
|
|
73
|
+
python -m pip install pandas-arango
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Quickstart
|
|
77
|
+
|
|
78
|
+
Connect with `python-arango`, read documents into a DataFrame, use pandas, and
|
|
79
|
+
write the result to another collection:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from arango import ArangoClient
|
|
83
|
+
from pandas_arango import read_collection, write_collection
|
|
84
|
+
|
|
85
|
+
client = ArangoClient(hosts="http://127.0.0.1:8529")
|
|
86
|
+
database = client.db("my_database", username="root", password="passwd")
|
|
87
|
+
|
|
88
|
+
users = read_collection(
|
|
89
|
+
database,
|
|
90
|
+
"users",
|
|
91
|
+
columns=["_key", "name", "active"],
|
|
92
|
+
)
|
|
93
|
+
active_users = users.loc[users["active"]]
|
|
94
|
+
|
|
95
|
+
result = write_collection(
|
|
96
|
+
active_users,
|
|
97
|
+
database,
|
|
98
|
+
"active_users",
|
|
99
|
+
mode="upsert",
|
|
100
|
+
create_collection=True,
|
|
101
|
+
)
|
|
102
|
+
print(result.written_count)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Use `read_aql` for custom queries and pass `chunksize` for large results.
|
|
106
|
+
|
|
107
|
+
### Advanced example
|
|
108
|
+
|
|
109
|
+
Converters let you store Python values that are not JSON-compatible by
|
|
110
|
+
default. This example preserves decimal prices as strings, converts UUIDs to
|
|
111
|
+
document keys, omits missing fields, and reads matching documents in chunks:
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from decimal import Decimal
|
|
115
|
+
from uuid import uuid4
|
|
116
|
+
|
|
117
|
+
import pandas as pd
|
|
118
|
+
from pandas_arango import read_aql, write_collection
|
|
119
|
+
|
|
120
|
+
measurements = pd.DataFrame(
|
|
121
|
+
[
|
|
122
|
+
{
|
|
123
|
+
"measurement_id": uuid4(),
|
|
124
|
+
"price": Decimal("19.95"),
|
|
125
|
+
"captured_at": pd.Timestamp.now(tz="UTC"),
|
|
126
|
+
"comment": pd.NA,
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
write_collection(
|
|
132
|
+
measurements,
|
|
133
|
+
database,
|
|
134
|
+
"measurements",
|
|
135
|
+
key_column="measurement_id",
|
|
136
|
+
create_collection=True,
|
|
137
|
+
null_policy="omit",
|
|
138
|
+
converters={"measurement_id": str, "price": str},
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
chunks = read_aql(
|
|
142
|
+
database,
|
|
143
|
+
"""
|
|
144
|
+
FOR measurement IN measurements
|
|
145
|
+
FILTER TO_NUMBER(measurement.price) >= @minimum_price
|
|
146
|
+
RETURN measurement
|
|
147
|
+
""",
|
|
148
|
+
bind_vars={"minimum_price": 10},
|
|
149
|
+
chunksize=10_000,
|
|
150
|
+
)
|
|
151
|
+
for chunk in chunks:
|
|
152
|
+
print(chunk[["_key", "price", "captured_at"]])
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Constraints
|
|
156
|
+
|
|
157
|
+
- Nested objects and arrays remain values in DataFrame cells by default.
|
|
158
|
+
- AQL projection is preferred; client-side flattening is opt-in.
|
|
159
|
+
- Writes accept JSON-compatible values. Other values require converters.
|
|
160
|
+
- Timezone-naive timestamps are rejected instead of assuming a timezone.
|
|
161
|
+
|
|
162
|
+
## More information
|
|
163
|
+
|
|
164
|
+
- [Example notebook](examples/example.ipynb)
|
|
165
|
+
- [Documentation](docs/index.rst)
|
|
166
|
+
- [Contributing and development](CONTRIBUTING.md)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# pandas-arango
|
|
2
|
+
|
|
3
|
+
`pandas-arango` is a synchronous connector for moving data between ArangoDB
|
|
4
|
+
documents and pandas DataFrames. It supports AQL and collection reads, chunked
|
|
5
|
+
results, and batched insert, update, replace, and upsert operations.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Python 3.11 or newer
|
|
10
|
+
- pandas 2.2 or newer
|
|
11
|
+
- python-arango 8.0 or newer
|
|
12
|
+
- A running ArangoDB server
|
|
13
|
+
|
|
14
|
+
Install it with:
|
|
15
|
+
|
|
16
|
+
```console
|
|
17
|
+
python -m pip install pandas-arango
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quickstart
|
|
21
|
+
|
|
22
|
+
Connect with `python-arango`, read documents into a DataFrame, use pandas, and
|
|
23
|
+
write the result to another collection:
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from arango import ArangoClient
|
|
27
|
+
from pandas_arango import read_collection, write_collection
|
|
28
|
+
|
|
29
|
+
client = ArangoClient(hosts="http://127.0.0.1:8529")
|
|
30
|
+
database = client.db("my_database", username="root", password="passwd")
|
|
31
|
+
|
|
32
|
+
users = read_collection(
|
|
33
|
+
database,
|
|
34
|
+
"users",
|
|
35
|
+
columns=["_key", "name", "active"],
|
|
36
|
+
)
|
|
37
|
+
active_users = users.loc[users["active"]]
|
|
38
|
+
|
|
39
|
+
result = write_collection(
|
|
40
|
+
active_users,
|
|
41
|
+
database,
|
|
42
|
+
"active_users",
|
|
43
|
+
mode="upsert",
|
|
44
|
+
create_collection=True,
|
|
45
|
+
)
|
|
46
|
+
print(result.written_count)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Use `read_aql` for custom queries and pass `chunksize` for large results.
|
|
50
|
+
|
|
51
|
+
### Advanced example
|
|
52
|
+
|
|
53
|
+
Converters let you store Python values that are not JSON-compatible by
|
|
54
|
+
default. This example preserves decimal prices as strings, converts UUIDs to
|
|
55
|
+
document keys, omits missing fields, and reads matching documents in chunks:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from decimal import Decimal
|
|
59
|
+
from uuid import uuid4
|
|
60
|
+
|
|
61
|
+
import pandas as pd
|
|
62
|
+
from pandas_arango import read_aql, write_collection
|
|
63
|
+
|
|
64
|
+
measurements = pd.DataFrame(
|
|
65
|
+
[
|
|
66
|
+
{
|
|
67
|
+
"measurement_id": uuid4(),
|
|
68
|
+
"price": Decimal("19.95"),
|
|
69
|
+
"captured_at": pd.Timestamp.now(tz="UTC"),
|
|
70
|
+
"comment": pd.NA,
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
write_collection(
|
|
76
|
+
measurements,
|
|
77
|
+
database,
|
|
78
|
+
"measurements",
|
|
79
|
+
key_column="measurement_id",
|
|
80
|
+
create_collection=True,
|
|
81
|
+
null_policy="omit",
|
|
82
|
+
converters={"measurement_id": str, "price": str},
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
chunks = read_aql(
|
|
86
|
+
database,
|
|
87
|
+
"""
|
|
88
|
+
FOR measurement IN measurements
|
|
89
|
+
FILTER TO_NUMBER(measurement.price) >= @minimum_price
|
|
90
|
+
RETURN measurement
|
|
91
|
+
""",
|
|
92
|
+
bind_vars={"minimum_price": 10},
|
|
93
|
+
chunksize=10_000,
|
|
94
|
+
)
|
|
95
|
+
for chunk in chunks:
|
|
96
|
+
print(chunk[["_key", "price", "captured_at"]])
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Constraints
|
|
100
|
+
|
|
101
|
+
- Nested objects and arrays remain values in DataFrame cells by default.
|
|
102
|
+
- AQL projection is preferred; client-side flattening is opt-in.
|
|
103
|
+
- Writes accept JSON-compatible values. Other values require converters.
|
|
104
|
+
- Timezone-naive timestamps are rejected instead of assuming a timezone.
|
|
105
|
+
|
|
106
|
+
## More information
|
|
107
|
+
|
|
108
|
+
- [Example notebook](examples/example.ipynb)
|
|
109
|
+
- [Documentation](docs/index.rst)
|
|
110
|
+
- [Contributing and development](CONTRIBUTING.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""ArangoDB integration for pandas."""
|
|
2
|
+
|
|
3
|
+
from pandas_arango.read import iter_aql, read_aql, read_collection
|
|
4
|
+
from pandas_arango.write import WriteError, WriteResult, write_collection
|
|
5
|
+
|
|
6
|
+
__all__ = [
|
|
7
|
+
"WriteError",
|
|
8
|
+
"WriteResult",
|
|
9
|
+
"iter_aql",
|
|
10
|
+
"read_aql",
|
|
11
|
+
"read_collection",
|
|
12
|
+
"write_collection",
|
|
13
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Package-specific exceptions."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Document and DataFrame normalization helpers."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|