-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
268 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,27 @@ | ||
# CHANGELOG | ||
|
||
|
||
|
||
## v0.2.0 (2023-10-14) | ||
|
||
### Chore | ||
|
||
* chore: fix pyproject.toml (#5) ([`e9063ff`](https://github.com/nadobando/pydangorm/commit/e9063ff034e4042d778b992aff2c55191d416fa9)) | ||
- chore: fix pyproject.toml (#5) ([`e9063ff`](https://github.com/nadobando/pydangorm/commit/e9063ff034e4042d778b992aff2c55191d416fa9)) | ||
|
||
### Feature | ||
|
||
* feat: support collection config kwargs some session utils and refactor ([`adf7f1a`](https://github.com/nadobando/pydangorm/commit/adf7f1a700b7537eaf7714e9d19abd331836be5f)) | ||
- feat: support collection config kwargs some session utils and refactor ([`adf7f1a`](https://github.com/nadobando/pydangorm/commit/adf7f1a700b7537eaf7714e9d19abd331836be5f)) | ||
|
||
### Fix | ||
|
||
* fix: mini refactor of files ([`0e711c7`](https://github.com/nadobando/pydangorm/commit/0e711c715614e6c4f0fb39951ae9969a79c3f72c)) | ||
|
||
* fix: moved query execution to session ([`6957559`](https://github.com/nadobando/pydangorm/commit/6957559a25ef5bb75a3b66dbd45403987a3a633f)) | ||
- fix: mini refactor of files ([`0e711c7`](https://github.com/nadobando/pydangorm/commit/0e711c715614e6c4f0fb39951ae9969a79c3f72c)) | ||
|
||
- fix: moved query execution to session ([`6957559`](https://github.com/nadobando/pydangorm/commit/6957559a25ef5bb75a3b66dbd45403987a3a633f)) | ||
|
||
## v0.1.0 (2023-09-25) | ||
|
||
### Build | ||
|
||
* build: add py.typed (#3) ([`eb642eb`](https://github.com/nadobando/pydangorm/commit/eb642ebba7cba67b0fc37352776f2f23cedb6330)) | ||
- build: add py.typed (#3) ([`eb642eb`](https://github.com/nadobando/pydangorm/commit/eb642ebba7cba67b0fc37352776f2f23cedb6330)) | ||
|
||
### Feature | ||
|
||
* feat: save and fetch models (#1) ([`8935e4f`](https://github.com/nadobando/pydangorm/commit/8935e4f8ec5c39f300cb7f818000fe8563e21989)) | ||
- feat: save and fetch models (#1) ([`8935e4f`](https://github.com/nadobando/pydangorm/commit/8935e4f8ec5c39f300cb7f818000fe8563e21989)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
## **`query.py`** | ||
|
||
The module within the orm sub-package provides functionalities and structures for ORM-based querying in | ||
relation to ArangoDB. | ||
It integrates with various parts of the ORM and aids in constructing and executing queries. | ||
|
||
#### Key Features | ||
|
||
- Automatic binding | ||
- `AQL` injection protection | ||
- query building | ||
|
||
## **`ORMQuery`** | ||
|
||
The `ORMQuery` class is a subclass of `AQLQuery`. | ||
It provides a Pythonic API for constructing queries for ArangoDB. | ||
|
||
## builder helpers | ||
|
||
### `for_()` | ||
|
||
the `for_()` method is used to specify the target vertex/edge collection of the query. | ||
|
||
```python | ||
from pydango.orm import for_ | ||
|
||
|
||
for_(User).filter(User.name == "John Doe").return_(User) | ||
``` | ||
|
||
### `traverse()` | ||
|
||
```python | ||
from pydango.orm import traverse | ||
from pydango.query.expressions import IteratorExpression | ||
from pydango.query import TraversalDirection | ||
|
||
edge = IteratorExpression() | ||
traverse( | ||
(User, edge), | ||
edges={"friends"}, | ||
start="people/1", | ||
depth=(0, 1), | ||
direction=TraversalDirection.OUTBOUND, | ||
).filter(User.name == "John Doe").return_(User) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
Certainly. Let's create the documentation for the `vertex.py` module in a developer-friendly format. | ||
|
||
______________________________________________________________________ | ||
|
||
## Vertex Module Documentation | ||
|
||
### Introduction | ||
|
||
The `vertex.py` module is integral to the `pydango` ORM, providing foundational classes and utilities for representing | ||
and working with vertices in ArangoDB. | ||
|
||
### Classes | ||
|
||
#### 1. VertexCollectionConfig | ||
|
||
- **Description**: Configuration specific to a vertex collection in ArangoDB. | ||
- **Attributes**: | ||
- `type`: Set to `CollectionType.NODE`, this attribute classifies the collection as a node or vertex collection in | ||
ArangoDB. | ||
|
||
#### 2. VertexMeta (Metaclass) | ||
|
||
- **Description**: A custom metaclass for vertex models. It processes namespace information, defines relationships | ||
between vertices, and sets up edge models during the class creation process. | ||
|
||
- **Methods**: | ||
|
||
- `_build_edge_to_field_mapping(relationships: Relationships) -> EdgeFieldMapping`: | ||
|
||
- **Purpose**: Constructs a mapping between edges and fields based on provided relationships. | ||
- **Parameters**: | ||
- `relationships`: Relationship information between vertices. | ||
|
||
- `_validate_edges(edge_to_field_mapping: EdgeFieldMapping, namespace: dict) -> None`: | ||
|
||
- **Purpose**: Validates the constructed edge-to-field mappings. | ||
- **Parameters**: | ||
- `edge_to_field_mapping`: Mapping between edges and fields. | ||
- `namespace`: Current namespace of the class being processed. | ||
|
||
- `_build_model(relationships: Relationships, name: str) -> Model`: | ||
|
||
- **Purpose**: Constructs a model based on provided relationships and name. | ||
- **Parameters**: | ||
- `relationships`: Relationship information between vertices. | ||
- `name`: Name for the constructed model. | ||
|
||
#### 3. VertexModel | ||
|
||
- **Description**: Represents a vertex model in the ORM. It defines and manages vertices and their relationships to | ||
edges. | ||
|
||
- **Attributes**: | ||
|
||
- `edges`: Represents the edges related to this vertex. | ||
- `__edge_to_field_mapping__`: A dictionary mapping edges to their respective fields. | ||
|
||
- **Methods**: | ||
|
||
- `__init__(self, **data: Any) -> None`: | ||
|
||
- **Purpose**: Initializes the vertex model. | ||
- **Parameters**: | ||
- `data`: Data to initialize the vertex model with. | ||
|
||
- `dict(self, ...) -> dict`: | ||
|
||
- **Purpose**: Extracts the data from the model in a dictionary format. | ||
- **Parameters**: | ||
- Various parameters to customize the output, such as `include`, `exclude`, `by_alias`, etc. | ||
|
||
### Tips for Developers: | ||
|
||
1. When defining a vertex model, extend the `VertexModel` class. Use the provided utilities and methods to ensure proper | ||
relationships and data handling. | ||
1. The `VertexMeta` metaclass processes and sets up relationships during class creation. Ensure that relationships are | ||
defined correctly to leverage the ORM's capabilities. | ||
1. Utilize the `VertexModel`'s `dict` method for data extraction and serialization. | ||
|
||
______________________________________________________________________ | ||
|
||
This documentation provides an overview and developer-centric guide to the `vertex.py` module. Adjustments can be made | ||
based on further content or specific requirements. Would you like to proceed with another section or topic? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Expressions | ||
# **Expressions** | ||
|
||
## **Basic Expressions** | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Functions | ||
# **Functions** | ||
|
||
## **Abstract Functions** | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.