Skip to content

Commit

Permalink
[main < develop] Publish GQLAlchemy 1.2 (#129)
Browse files Browse the repository at this point in the history
* add code documentation

* add receive and return types

* add python-markdown with docusaurus renderer

* add documentation for the query builder

* Update docs

* Fix formatting

* Add tests for docs

* Fix NodePartialQuery and Merge

* Add load node test

* Add node mapping test

* Remove description

* Minor fixes

* Add test for relationship mapping

* Add save relationship tests

* Add load tests

* Add testing without Field

* Fix formatting in node labels and properties

* Expose validator from pydantic

* Add pydantic validator test

* Refactor fixtures

* Add base and simple merge tests

* Remove space from trigger test

* Ignore test test_run_1000_queries

* Add test for constraints

* Add new fixture

* Add trigger ALL check, xor and constraint check

* Add unique and exists contraints getters

* Remove indices - not necessary

* Add test for index attribute

* Remove ensure indexes from fixture

* Add and, or, xor tests

* Add XOR and LOAD CSV to query builder and fix optional in Merge

* Refactor code

* Refactor tests

* Add execute option to query builder

* change tests

* Fix review comments

* Fix constraint tests

* Remove print()

* Replace execute_and_fetch with execute

* Add create trigger without ON

* Add simpler implementation

* bootstrap_servers argument usage

* property->item and removed spaces when it is label

* List[str] instead of List

* patch slight merge difference

* pymgclient back to 1.1.0

* poetry.lock revert to develop setting

* formatting correction

* revert pyproject.toml to develop

* revert poetry.lock to develop

* black formatting patch

* Update pymgclient and GQLAlchemy version

* Update pymgclient and GQLAlchemy version

* Change to load the whole streamer node

* Remove unnecessary test

* Add tests

* Add batch save methods

* Extend test

* Format code

* Fix save_node() method and add new test

* Test node & relationship objects in query builder

* Add tests for loading and properties

* property->item and removed spaces when it is label

* patch slight merge difference

* pymgclient back to 1.1.0

* poetry.lock revert to develop setting

* formatting correction

* Update pymgclient and GQLAlchemy version

* bootstrap_servers argument usage

* List[str] instead of List

* revert pyproject.toml to develop

* revert poetry.lock to develop

* Update pymgclient and GQLAlchemy version

* Add load node test

* Minor fixes

* Add testing without Field

* change tests

* Change to load the whole streamer node

* Remove unnecessary test

* Update

* Update tests

* Change 'property' to 'item' in xor_where

* Fix creating query with label

* Add tests for label filtering in where

* Update exception handling in test

* Remove where tests

* Fix if condition statement

* Remove unnecessary variable assignments

* [develop < T0040-GA] Add index on label (#113)

* Add new exception class for index on label

* Add index on label with tests

* Add new lines

* Add newlines again

* Change test according to docs

* Remove None from attrs.get

* [develop < T0020-GA] Fix label inheritance (#105)

* Research label behaviour

* Save parent class labels

* Fix black format

* Fix inheritance from multiple classes

* Remove prints

* Refactor code

* Reformat with black

* Skip set union if not necessary

* Replace if statement

* Refactor code

Co-authored-by: katarinasupe <[email protected]>

* [develop < T0039-GA] Change where procedure in query builder (#111)

* Add new where methods and tests

* Fix other tests accordingly (4)

* Change error message check

* Add better error handling and fix tests

* Remove code duplication

* Fix docstring

* Add all docstrings

* Make build where private

* Refactor code

* Fix black and flake

* _build_where_query method updated

* formatting

Co-authored-by: Boris Tasevski <[email protected]>

* [develop < T0035 - GA] Add table to graph importer (#100)

* initial implementation of loader/translator logic; No tests added

* query builder updated with two new functionalities; 1) Where Clause that compares two properties in database; 2) construct_query method that simply exposes _construct_query protected method

* major naming changes; minor code reorganization

* Blank spaces

* Minor naming changes; Initial documentation;

* code refactoring; introduced dacite

* Introduced mapping class; Template Trigger Query introduced; Save row as relationship rehauled

* Added drop all indexes and drop all triggers to memgraph; Trigger query creation is now static method

* parameter fix

* Minor Typing related changes

* remove unused import

* Format document

* Fixed Query Builder Where test

* Where clause additional fix

* import fix

* rename parameter; remove unnecessary typing

* Small bugfix; Minor refactoring

* drop database on start set to True in translate method

* docs update; format of dataset introduced. If omitted, defaults to parquet

Co-authored-by: Boris Tasevski <[email protected]>

* [develop < T0046-GA] Add order by descending (#114)

* Add order_by_desc and test

* Fix DESC and add keyword in test

* Desc inherits from OrderBy

* Add new order_by

* Order By revamped

* Add type error and key arguments in tests

* Add missing quotes

* reduced line length under 80

* Remove trailing whitespaces

* Add query check before execution

* Where clause related classes rewritten

* order by related methods moved to OrderByPartialQuery class

* minor code fix

* Add where and order_by examples to docstrings

* Add NOT and fix tests

* Add docstring examples

* Remove blank lines after docstrings

Co-authored-by: Boris Tasevski <[email protected]>

* [develop < T0001-GA] Memgraph instance runner (#91)

* Add initial instance runner

* Update instance_runner

* Update instance runner

* Update Docker runner

* Add Ubutnu runner

* Remove Ubuntu instance runner

* Remove prints

* Fix instance_runner test

* Fix binary test

* Fix step order in workflow

* Add sudo to test

* Skip some tests in Windows workflow

* Pull Docker image in Windows workflow

* Update Docker image in Windows workflow

* Update Docker image in Windows workflow

* Skip some tests in Windows workflow

* Remove Docker pull from Windows workflow

* Add more tests and fix Docker bug

* Refactor tests and binary runner

* Refactor code and add docstrings

* Fix docstring formatting

* Fix formatting

* Replace strings with constants

* Add tests and new method

* Add docker mark to test

* Add constants and formatting

* Add f strings

* Add exponential backoff

* Fix formatting

* Fix formatting

* Update connection retry delay time

* Add checklist and closes keyword (#127)

* [develop < T0023-GA]  Add Azure Blob and local storage importers (#104)

* initial implementation of loader/translator logic; No tests added

* query builder updated with two new functionalities; 1) Where Clause that compares two properties in database; 2) construct_query method that simply exposes _construct_query protected method

* major naming changes; minor code reorganization

* Blank spaces

* Blob datasource and importer

* Minor naming changes; Initial documentation;

* refactoring loaders.py

* Boris loaders

* code refactoring; introduced dacite

* boriss commit, added comments

* tiny fix

* removed doubling of where method

* Mrma; replaced filesystem_type str with enum, added ValueError output

* added enum for DataLoaders, extracted supported filetypes

* Update loaders.py

* returned Boris' query_builder code

* I am bad at git

* Introduced mapping class; Template Trigger Query introduced; Save row as relationship rehauled

* Added drop all indexes and drop all triggers to memgraph; Trigger query creation is now static method

* parameter fix

* Minor Typing related changes

* remove unused import

* Format document

* added custom importers + minor changes

* extracted some strings

* minor fix

* Fixed Query Builder Where test

* Where clause additional fix

* tests for importer

* tiny fixes

* Black formatting

* further black formatting

* workflows edit

* flake8 format

* reverted workflows

* indentation

* comment styling

* removed changes not by me

* added tests with other filetypes, bugfix

* add filetype examples

* merging bugfix

* dodao print-eve kako Boris zapoveda

* formatting for BLACK

* orc file not readable on Windows

* fix previous commit

* latest changes

* applied tests

* docstrings update

* poetry update

* revert poetry.lock

* one more

* revert version of pywin32

* Update docstrings

Co-authored-by: Boris Tasevski <[email protected]>
Co-authored-by: Ivan Despot <[email protected]>

* [develop < T0048-GA] Update and extend code documentation (#116)

* Update the query_builder documentation

* Update docs

Co-authored-by: MasterMedo <[email protected]>
Co-authored-by: katarinasupe <[email protected]>
Co-authored-by: Bruno Sacaric <[email protected]>
Co-authored-by: Bruno Sačarić <[email protected]>
Co-authored-by: Boris Taševski <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>
Co-authored-by: Boris Tasevski <[email protected]>
  • Loading branch information
8 people authored Apr 12, 2022
1 parent e12093f commit 12a05b6
Show file tree
Hide file tree
Showing 57 changed files with 6,575 additions and 821 deletions.
15 changes: 14 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Please briefly explain the changes you made here.

### Pull request type

Please delete options that are not relevant.

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
Expand All @@ -15,7 +17,18 @@ Please briefly explain the changes you made here.

### Related issues

Delete section if this PR doesn't resolve any issues. Link the issue if it does.
Delete section if this PR doesn't resolve any issues.

Closes (link to issue)

### Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes

######################################

Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jobs:
- name: Run memgraph instance
run: |
docker run -d -p 7687:7687 memgraph/memgraph --telemetry-enabled=False
- name: Install Memgraph
run: |
curl -O https://download.memgraph.com/memgraph/v2.2.1/ubuntu-20.04/memgraph_2.2.1-1_amd64.deb
sudo dpkg -i memgraph_2.2.1-1_amd64.deb
- name: Test project
run: |
poetry install
Expand Down Expand Up @@ -71,4 +75,4 @@ jobs:
- name: Test project
run: |
poetry install
poetry run pytest -vvv -m "not slow"
poetry run pytest -vvv -m "not slow and not ubuntu and not docker"
77 changes: 0 additions & 77 deletions docs/reference/gqlalchemy/connection.md

This file was deleted.

53 changes: 53 additions & 0 deletions docs/reference/gqlalchemy/disk_storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ title: gqlalchemy.disk_storage
class OnDiskPropertyDatabase(ABC)
```

An abstract class for implementing on-disk storage features with specific databases.

#### save\_node\_property

```python
Expand Down Expand Up @@ -79,6 +81,15 @@ def execute_query(query: str) -> List[str]

Executes an SQL query on the on disk property database.

**Arguments**:

- `query` - A string representing an SQL query.


**Returns**:

A list of strings representing the results of the query.

#### drop\_database

```python
Expand All @@ -95,6 +106,12 @@ def save_node_property(node_id: int, property_name: str, property_value: str) ->

Saves a node property to an on disk database.

**Arguments**:

- `node_id` - An integer representing the internal id of the node.
- `property_name` - A string representing the name of the property.
- `property_value` - A string representing the value of the property.

#### load\_node\_property

```python
Expand All @@ -103,6 +120,16 @@ def load_node_property(node_id: int, property_name: str) -> Optional[str]

Loads a node property from an on disk database.

**Arguments**:

- `node_id` - An integer representing the internal id of the node.
- `property_name` - A string representing the name of the property.


**Returns**:

An optional string representing the property value.

#### delete\_node\_property

```python
Expand All @@ -111,6 +138,11 @@ def delete_node_property(node_id: int, property_name: str) -> None

Deletes a node property from an on disk database.

**Arguments**:

- `node_id` - An integer representing the internal id of the node.
- `property_name` - A string representing the name of the property.

#### save\_relationship\_property

```python
Expand All @@ -119,6 +151,12 @@ def save_relationship_property(relationship_id: int, property_name: str, propert

Saves a relationship property to an on disk database.

**Arguments**:

- `relationship_id` - An integer representing the internal id of the relationship.
- `property_name` - A string representing the name of the property.
- `property_value` - A string representing the value of the property.

#### load\_relationship\_property

```python
Expand All @@ -127,6 +165,16 @@ def load_relationship_property(relationship_id: int, property_name: str) -> Opti

Loads a relationship property from an on disk database.

**Arguments**:

- `relationship_id` - An integer representing the internal id of the relationship.
- `property_name` - A string representing the name of the property.


**Returns**:

An optional string representing the property value.

#### delete\_relationship\_property

```python
Expand All @@ -135,3 +183,8 @@ def delete_relationship_property(relationship_id: int, property_name: str) -> No

Deletes a node property from an on disk database.

**Arguments**:

- `relationship_id` - An integer representing the internal id of the relationship.
- `property_name` - A string representing the name of the property.

134 changes: 134 additions & 0 deletions docs/reference/gqlalchemy/instance_runner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
---
sidebar_label: instance_runner
title: gqlalchemy.instance_runner
---

#### wait\_for\_port

```python
def wait_for_port(host: str = "127.0.0.1", port: int = 7687, delay: float = 0.01, timeout: float = 5.0) -> None
```

Wait for a TCP port to become available.

**Arguments**:

- `host` - A string representing the IP address that is being checked.
- `port` - A string representing the port that is being checked.
- `delay` - A float that defines how long to wait between retries.
- `timeout` - A float that defines how long to wait for the port.


**Raises**:

- `TimeoutError` - Raises an error when the host and port are not accepting
connections after the timeout period has passed.

#### wait\_for\_docker\_container

```python
def wait_for_docker_container(container: "docker.Container", delay: float = 0.01, timeout: float = 5.0) -> None
```

Wait for a Docker container to enter the status `running`.

**Arguments**:

- `container` - The Docker container to wait for.
- `delay` - A float that defines how long to wait between retries.
- `timeout` - A float that defines how long to wait for the status.


**Raises**:

- `TimeoutError` - Raises an error when the container isn&#x27;t running after the
timeout period has passed.

## MemgraphInstanceBinary Objects

```python
class MemgraphInstanceBinary(MemgraphInstance)
```

A class for managing Memgraph instances started from binary files on Unix
systems.

**Attributes**:

- `binary_path` - A string representing the path to a Memgraph binary
file.
- `user` - A string representing the user that should start the Memgraph
process.

#### start

```python
def start(restart: bool = False) -> "Memgraph"
```

Start the Memgraph instance and return the connection object.

**Attributes**:

- `restart` - A bool indicating if the instance should be
restarted if it&#x27;s already running.

#### stop

```python
def stop() -> int
```

Stop the Memgraph instance.

#### is\_running

```python
def is_running() -> bool
```

Check if the Memgraph instance is still running.

## MemgraphInstanceDocker Objects

```python
class MemgraphInstanceDocker(MemgraphInstance)
```

A class for managing Memgraph instances started in Docker containers.

**Attributes**:

- `docker_image` - An enum representing the Docker image. Values:
`DockerImage.MEMGRAPH` and `DockerImage.MAGE`.
- `docker_image_tag` - A string representing the tag of the Docker image.

#### start

```python
def start(restart: bool = False) -> "Memgraph"
```

Start the Memgraph instance and return the connection object.

**Attributes**:

- `restart` - A bool indicating if the instance should be
restarted if it&#x27;s already running.

#### stop

```python
def stop() -> Dict
```

Stop the Memgraph instance.

#### is\_running

```python
def is_running() -> bool
```

Check if the Memgraph instance is still running.

Loading

0 comments on commit 12a05b6

Please sign in to comment.