surrealdb-orm 0.1.4__py3-none-any.whl → 0.5.0__py3-none-any.whl
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.
- surreal_orm/__init__.py +72 -3
- surreal_orm/aggregations.py +164 -0
- surreal_orm/auth/__init__.py +15 -0
- surreal_orm/auth/access.py +167 -0
- surreal_orm/auth/mixins.py +302 -0
- surreal_orm/cli/__init__.py +15 -0
- surreal_orm/cli/commands.py +369 -0
- surreal_orm/connection_manager.py +58 -18
- surreal_orm/fields/__init__.py +36 -0
- surreal_orm/fields/encrypted.py +166 -0
- surreal_orm/fields/relation.py +465 -0
- surreal_orm/migrations/__init__.py +51 -0
- surreal_orm/migrations/executor.py +380 -0
- surreal_orm/migrations/generator.py +272 -0
- surreal_orm/migrations/introspector.py +305 -0
- surreal_orm/migrations/migration.py +188 -0
- surreal_orm/migrations/operations.py +531 -0
- surreal_orm/migrations/state.py +406 -0
- surreal_orm/model_base.py +530 -44
- surreal_orm/query_set.py +609 -33
- surreal_orm/relations.py +645 -0
- surreal_orm/surreal_function.py +95 -0
- surreal_orm/surreal_ql.py +113 -0
- surreal_orm/types.py +86 -0
- surreal_sdk/README.md +79 -0
- surreal_sdk/__init__.py +151 -0
- surreal_sdk/connection/__init__.py +17 -0
- surreal_sdk/connection/base.py +516 -0
- surreal_sdk/connection/http.py +421 -0
- surreal_sdk/connection/pool.py +244 -0
- surreal_sdk/connection/websocket.py +519 -0
- surreal_sdk/exceptions.py +71 -0
- surreal_sdk/functions.py +607 -0
- surreal_sdk/protocol/__init__.py +13 -0
- surreal_sdk/protocol/rpc.py +218 -0
- surreal_sdk/py.typed +0 -0
- surreal_sdk/pyproject.toml +49 -0
- surreal_sdk/streaming/__init__.py +31 -0
- surreal_sdk/streaming/change_feed.py +278 -0
- surreal_sdk/streaming/live_query.py +265 -0
- surreal_sdk/streaming/live_select.py +369 -0
- surreal_sdk/transaction.py +386 -0
- surreal_sdk/types.py +346 -0
- surrealdb_orm-0.5.0.dist-info/METADATA +465 -0
- surrealdb_orm-0.5.0.dist-info/RECORD +52 -0
- {surrealdb_orm-0.1.4.dist-info → surrealdb_orm-0.5.0.dist-info}/WHEEL +1 -1
- surrealdb_orm-0.5.0.dist-info/entry_points.txt +2 -0
- {surrealdb_orm-0.1.4.dist-info → surrealdb_orm-0.5.0.dist-info}/licenses/LICENSE +1 -1
- surrealdb_orm-0.1.4.dist-info/METADATA +0 -184
- surrealdb_orm-0.1.4.dist-info/RECORD +0 -12
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: surrealdb-orm
|
|
3
|
-
Version: 0.1.4
|
|
4
|
-
Summary: SurrealDB ORM as 'DJango style' for Python with async support. Works with pydantic validation.
|
|
5
|
-
Project-URL: Homepage, https://github.com/EulogySnowfall/SurrealDB-ORM
|
|
6
|
-
Project-URL: Documentation, https://github.com/EulogySnowfall/SurrealDB-ORM
|
|
7
|
-
Project-URL: Repository, https://github.com/EulogySnowfall/SurrealDB-ORM.git
|
|
8
|
-
Project-URL: Issues, https://github.com/EulogySnowfall/SurrealDB-ORM/issues
|
|
9
|
-
Author-email: Yannick Croteau <yannick.croteau@gmail.com>
|
|
10
|
-
License: # MIT License
|
|
11
|
-
|
|
12
|
-
Copyright (c) 2024 Yannick Croteau
|
|
13
|
-
|
|
14
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
-
in the Software without restriction, including without limitation the rights
|
|
17
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
-
furnished to do so, subject to the following conditions:
|
|
20
|
-
|
|
21
|
-
The above copyright notice and this permission notice shall be included in all
|
|
22
|
-
copies or substantial portions of the Software.
|
|
23
|
-
|
|
24
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
-
SOFTWARE.
|
|
31
|
-
License-File: LICENSE
|
|
32
|
-
Classifier: Development Status :: 3 - Alpha
|
|
33
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
-
Classifier: Operating System :: OS Independent
|
|
35
|
-
Classifier: Programming Language :: Python :: 3
|
|
36
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
37
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
38
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
39
|
-
Classifier: Topic :: Database
|
|
40
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
41
|
-
Requires-Python: >=3.11
|
|
42
|
-
Requires-Dist: pydantic>=2.10.4
|
|
43
|
-
Requires-Dist: surrealdb>=0.4.1
|
|
44
|
-
Description-Content-Type: text/markdown
|
|
45
|
-
|
|
46
|
-
# SurrealDB-ORM
|
|
47
|
-
|
|
48
|
-

|
|
49
|
-

|
|
50
|
-
[](https://codecov.io/gh/EulogySnowfall/SurrealDB-ORM)
|
|
51
|
-

|
|
52
|
-
|
|
53
|
-
🚀 **SurrealDB-ORM** is a lightweight ORM (Object-Relational Mapping) inspired by Django ORM, designed to simplify interactions with **SurrealDB** in Python projects. It provides an intuitive way to manage models, perform queries, and execute CRUD (Create, Read, Update, Delete) operations.
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## 📋 Table of Contents
|
|
58
|
-
|
|
59
|
-
- [Version](#-version)
|
|
60
|
-
- [Description](#-description)
|
|
61
|
-
- [Requirements and tested based](#-requirements-and-tested-based)
|
|
62
|
-
- [Installation](#-installation)
|
|
63
|
-
- [Usage Example](#-usage-example)
|
|
64
|
-
- [Features](#-features)
|
|
65
|
-
- [Contributing](#-contributing)
|
|
66
|
-
- [TODO](#-todo)
|
|
67
|
-
- [License](#-license)
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## ✅ Version
|
|
72
|
-
|
|
73
|
-
Alpha 0.1.4
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## 📝 Description
|
|
78
|
-
|
|
79
|
-
SurrealDB-ORM offers a clean abstraction for handling SurrealDB through Python models.
|
|
80
|
-
The goal is to simplify writing complex queries while providing an intuitive interface similar to modern ORMs like Django or SQLAlchemy.
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## 📝 Requirements and tested based
|
|
85
|
-
|
|
86
|
-
- Python : 3.11~3.13
|
|
87
|
-
- Pydantic : 2.10.4
|
|
88
|
-
- SurrealDB Database Version : 2.1.4
|
|
89
|
-
- You need to set a SurrealDB to connect to.
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
## 🛠️ Installation
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
pip install surrealdb-orm
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## 🚀 Usage Example
|
|
102
|
-
|
|
103
|
-
Here's a simple example demonstrating how to define a model and interact with SurrealDB:
|
|
104
|
-
|
|
105
|
-
### 1. Define a Model
|
|
106
|
-
|
|
107
|
-
```python
|
|
108
|
-
from surreal_orm.modelBase import BaseSurrealModel
|
|
109
|
-
from pydantic import BaseModel, Field
|
|
110
|
-
from typing import Optional
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
class User(BaseSurrealModel):
|
|
114
|
-
id: Optional[str] = None
|
|
115
|
-
name: str = Field(..., max_length=100)
|
|
116
|
-
email: str
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### 2. Create and Save a User
|
|
120
|
-
|
|
121
|
-
```python
|
|
122
|
-
user = User(name="Alice", email="alice@example.com")
|
|
123
|
-
await user.save()
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### 3. Query Users
|
|
127
|
-
|
|
128
|
-
```python
|
|
129
|
-
users = await User.objects().filter(name="Alice").exec()
|
|
130
|
-
for user in users:
|
|
131
|
-
print(user.name, user.email)
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
## 🌟 Features
|
|
137
|
-
|
|
138
|
-
- 🔧 **Model definition** using Pydantic
|
|
139
|
-
- 📄 **QuerySet** with filter methods like `filter()`, `limit()`, and `order_by()`
|
|
140
|
-
- 🔄 **CRUD** operations (Create, Read, Update, Delete)
|
|
141
|
-
- ⚙️ **Asynchronous connection** to SurrealDB
|
|
142
|
-
- 🔍 **Automatic validation** with Pydantic
|
|
143
|
-
- 📊 **Complex queries** with conditional filters (`age__gte`, `name__in`, etc.)
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## 🤝 Contributing
|
|
148
|
-
|
|
149
|
-
Contributions are welcome!
|
|
150
|
-
If you'd like to improve this project:
|
|
151
|
-
|
|
152
|
-
1. Fork the repository.
|
|
153
|
-
2. Create a branch (`git checkout -b feature/new-feature`).
|
|
154
|
-
3. Make your changes and commit them (`git commit -m "Add new feature"`).
|
|
155
|
-
4. Push to your branch (`git push origin feature/new-feature`).
|
|
156
|
-
5. Create a Pull Request.
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## 📌 TODO
|
|
161
|
-
|
|
162
|
-
- [ ] Implement relationships
|
|
163
|
-
- [ ] Add transaction support
|
|
164
|
-
- [ ] Optimize complex queries
|
|
165
|
-
- [ ] Expand documentation with advanced examples
|
|
166
|
-
- [ ] Better SurrealQL Integration
|
|
167
|
-
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
## 📄 License
|
|
171
|
-
|
|
172
|
-
This project is licensed under the **MIT License**. See the `LICENSE` file for more information.
|
|
173
|
-
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
### 📨 Contact
|
|
177
|
-
|
|
178
|
-
**Author:** Yannick Croteau
|
|
179
|
-
**Email:** <croteau.yannick@gmail.com>
|
|
180
|
-
**GitHub:** [EulogySnowfall](https://github.com/EulogySnowfall)
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
**SurrealDB-ORM** is a personal package to use with other projects. I will certainly improve it over the next few months, but feel free to open issues or suggest improvements 🚀
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
surreal_orm/__init__.py,sha256=p2dnNi1Ar0FNrLlC7oHtYiUrrdYwQKt--72_-omCElk,306
|
|
2
|
-
surreal_orm/connection_manager.py,sha256=kRAK6qhkKRVbhTjWZV6LaOGiH_jClwQ3zzmjca1A5Ro,8561
|
|
3
|
-
surreal_orm/constants.py,sha256=CLavEca1M6cLJLqVl4l4KoE-cBrgVQNsuGxW9zGJBmg,429
|
|
4
|
-
surreal_orm/enum.py,sha256=kR-vzkHqnqy9YaYOvWTwAHdl2-WCzPcSEch-YTyJv1Y,158
|
|
5
|
-
surreal_orm/model_base.py,sha256=zz6y8TQavk0XvLhunzQflJpPG85FizeCR-mAy-LHlK8,6082
|
|
6
|
-
surreal_orm/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
surreal_orm/query_set.py,sha256=VD8F2vKv5_uIXRCV_0HCx6lnarF-Qx3x8MYJq2LH78U,18155
|
|
8
|
-
surreal_orm/utils.py,sha256=mni_dTtb4VGTdge8eWSZpBw5xoWci2m-XThKFHYPKTo,171
|
|
9
|
-
surrealdb_orm-0.1.4.dist-info/METADATA,sha256=AFDw-vOKASG0mGa73Zo9CcaQKe-E-ocia3tOUJdcELY,5980
|
|
10
|
-
surrealdb_orm-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
11
|
-
surrealdb_orm-0.1.4.dist-info/licenses/LICENSE,sha256=TO3Ub0nPPx5NxwjsDuBAu3RBdBLmdDybqC5dem4oGts,1074
|
|
12
|
-
surrealdb_orm-0.1.4.dist-info/RECORD,,
|