Skip to content

Commit

Permalink
Release GQLAlchemy 1.3 (#173)
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

* [develop < TOO53-GA] Investigate Timeout error (#120)

* Update dependencies

* Increase Bolt session inactivity timeout

* Update workflow

* Update workflow

* Add config flag --also-log-to-stderr

* Catch Memgraph logs

* Catch Memgraph logs

* Update log level

* Upload log as artifact

* Add log file

* Create new log directory

* Run Action step even if error is thrown

* Change session nactivity timeout

* Change Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update GitHub action paths

* Update GitHub action paths

* Update GitHub action permissions

* Update GitHub action

* Update GitHub action

* Update GitHub action

* Update GitHub action

* Update GitHub action

* Update GitHub action

* [develop < T0070-GA] Add more clauses for base classes (#139)

* added load_csv, tests

* add return base class, change CSV to Csv

* black formatting

* [develop < T0071-GA-bfs-and-shortest-path] added base class and integrated into edge query (#141)

* added base class and integrated into edge query

* on comments

* comment fixes

* Add minor docstring changes

* Reorder imports

* convert other @Property's to positive logic

* boris comments

* add pass to abstractmethod

* removed temp var use

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

* [T0071-GA < BFS] add bfs class and tests (#142)

* added base class and integrated into edge query

* added bfs class and tests

* rename to BreadthFirstSearch

* on comments

* on comments

* comment fixes

* mrma comments

* Add minor docstring changes

* Update memgraph.py

* boris comments

* flake8 fixes

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

* [develop < T0059-GA] Add SET method to the query builder (#128)

* Introduced SET Clause support

* Implementation Done; Tests Added

* formatting

* minor formatting

* Removed templates

* unused imports removed

* unused imports removed

* Rename to SetOperator and add new tests

* Add query clause enum in exceptions

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

* [T0071-GA < DFS] add dfs and tests (#144)

* added base class and integrated into edge query

* add dfs and tests

* on comments

* add bounds tests and (e, v) -> (r, n)

* comment fixes

* mrma comments

* blank line removal

* boris comments

* remove duplicate code

* duplicate code

* fix

* [T0071-GA < wShortest] added WeightedShortestPath and tests (#143)

* added base class and integrated into edge query

* added wShortest and tests

* on comments

* comment fixes

* mrma comments and refactoring

* another

* fix

* make upper bound str since the init

* [develop < T0026-GA] Wrap query modules (#130)

* first draft

* stash changes 2

* finished parse_signature

* make it work, add docstrings

* formatting

* added tests +

* reorganize tests

* add mock test for get_procedures, to avoid needing MAGE

* startswith -> starts_with

* starts_with in docstring

* ok i will not edit in github again. starts_with in description

* refactor _parse_field

* added QB test, moved parser to utilities, Kate changes

* test fix

* refactor and comments from Mrma

* comments fixes

* finish merge lol

* [develop < T0081-GA] Rename Edge to Relationship (#145)

* Rename edge to relationship; add kwargs in tests

* Fix test on docs

* [develop < TOO53-GA] Investigate Timeout error (#120)

* Update dependencies

* Increase Bolt session inactivity timeout

* Update workflow

* Update workflow

* Add config flag --also-log-to-stderr

* Catch Memgraph logs

* Catch Memgraph logs

* Update log level

* Upload log as artifact

* Add log file

* Create new log directory

* Run Action step even if error is thrown

* Change session nactivity timeout

* Change Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update GitHub action paths

* Update GitHub action paths

* Update GitHub action permissions

* Update GitHub action

* Update GitHub action

* Update GitHub action

* Update GitHub action

* Update GitHub action

* Update GitHub action

* [develop < T0070-GA] Add more clauses for base classes (#139)

* added load_csv, tests

* add return base class, change CSV to Csv

* black formatting

* Change edge in loaders

* Change labels_str -> type_str; edge_label-> relationship_type

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Bruno Sačarić <[email protected]>

* moved integrated algorithms (#147)

* [develop < T0034-GA] Add Field to models (#122)

* Add Field to models

* Remove Field from gqlalchemy init

* [develop < T0054-GA] Add option to suppress warning GQLAlchemySubclassNotFoundWarning (#121)

* Ignore warning in tests

* Set lazy loading to false

* Add codeowner

* host and port read only (#156)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* host and port read only

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

* [develop < T0094-GA] Variable support for node and edge properties (#154)

* added functionality and tests

* add docstring

* add test for relationship

* black

* migrated check to to_cypher_value

* community fixes

* change test names

* type checking

* renamed variable value to name

* new connection private method (#157)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* new connection private method

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

* [develop < T0074-GA] Remove sudo from instance_runner (#148)

* Remove sudo

* Remove unused import

* exceptions fixed (#153)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* exceptions fixed

* fixed stream tests

* reformatting

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* exceptions fixed

* fixed stream tests

* reformatting

* rebased

* exceptions fixed

* reformatting

* renamed

* fixed

* Added new line

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

* Add lazy argument to Memgraph (#159)

* [develop < T0098-GA] Add datetime support (#161)

* Add datetime support

* Change value_type to value

* Add new tests

* Format timedelta and add datetime tests

* Add datetimeKwMapping and change call to one-liner

* Fix flake8

* Fix import formatting

Co-authored-by: g-despot <[email protected]>

* changed string variables for Blob and S3 kwargs (#151)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* changed string variables for Blob and S3 kwargs

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

* [develop < T0086-GA] Change arguments in RETURN method (#146)

* Change arguments in return method

* Add backward compatibility

* Add newline

* Add minor changes

* Add Iterable and fix if logic

* add enum

* Remove super call; Add Iterable to OrderBy; Remove read_str method

* Change arguments for yield, with; create new class

* Remove unnecessary super constructor call

* [develop < T0071-GA-bfs-and-shortest-path] added base class and integrated into edge query (#141)

* added base class and integrated into edge query

* on comments

* comment fixes

* Add minor docstring changes

* Reorder imports

* convert other @Property's to positive logic

* boris comments

* add pass to abstractmethod

* removed temp var use

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

* [T0071-GA < BFS] add bfs class and tests (#142)

* added base class and integrated into edge query

* added bfs class and tests

* rename to BreadthFirstSearch

* on comments

* on comments

* comment fixes

* mrma comments

* Add minor docstring changes

* Update memgraph.py

* boris comments

* flake8 fixes

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

* [develop < T0059-GA] Add SET method to the query builder (#128)

* Introduced SET Clause support

* Implementation Done; Tests Added

* formatting

* minor formatting

* Removed templates

* unused imports removed

* unused imports removed

* Rename to SetOperator and add new tests

* Add query clause enum in exceptions

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

* [T0071-GA < DFS] add dfs and tests (#144)

* added base class and integrated into edge query

* add dfs and tests

* on comments

* add bounds tests and (e, v) -> (r, n)

* comment fixes

* mrma comments

* blank line removal

* boris comments

* remove duplicate code

* duplicate code

* fix

* [T0071-GA < wShortest] added WeightedShortestPath and tests (#143)

* added base class and integrated into edge query

* added wShortest and tests

* on comments

* comment fixes

* mrma comments and refactoring

* another

* fix

* make upper bound str since the init

* [develop < T0059-GA] Add SET method to the query builder (#128)

* Introduced SET Clause support

* Implementation Done; Tests Added

* formatting

* minor formatting

* Removed templates

* unused imports removed

* unused imports removed

* Rename to SetOperator and add new tests

* Add query clause enum in exceptions

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

* [develop < T0026-GA] Wrap query modules (#130)

* first draft

* stash changes 2

* finished parse_signature

* make it work, add docstrings

* formatting

* added tests +

* reorganize tests

* add mock test for get_procedures, to avoid needing MAGE

* startswith -> starts_with

* starts_with in docstring

* ok i will not edit in github again. starts_with in description

* refactor _parse_field

* added QB test, moved parser to utilities, Kate changes

* test fix

* refactor and comments from Mrma

* comments fixes

* finish merge lol

* Add missing quotes and remove duplicate

* Remove extra line in exceptions

* Change to return only item

* Remove Iterable from argument type

* Change elif to if and remove else

* Remove Iterable from order_by

* [develop < T0081-GA] Rename Edge to Relationship (#145)

* Rename edge to relationship; add kwargs in tests

* Fix test on docs

* [develop < TOO53-GA] Investigate Timeout error (#120)

* Update dependencies

* Increase Bolt session inactivity timeout

* Update workflow

* Update workflow

* Add config flag --also-log-to-stderr

* Catch Memgraph logs

* Catch Memgraph logs

* Update log level

* Upload log as artifact

* Add log file

* Create new log directory

* Run Action step even if error is thrown

* Change session nactivity timeout

* Change Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update Ubuntu GitHub job

* Update GitHub action paths

* Update GitHub action paths

* Update GitHub action permissions

* Update GitHub action

* Update GitHub action

* Update GitHub action

* Update GitHub action

* Update GitHub action

* Update GitHub action

* [develop < T0070-GA] Add more clauses for base classes (#139)

* added load_csv, tests

* add return base class, change CSV to Csv

* black formatting

* Change edge in loaders

* Change labels_str -> type_str; edge_label-> relationship_type

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Bruno Sačarić <[email protected]>

* moved integrated algorithms (#147)

* [develop < T0034-GA] Add Field to models (#122)

* Add Field to models

* Remove Field from gqlalchemy init

* [develop < T0054-GA] Add option to suppress warning GQLAlchemySubclassNotFoundWarning (#121)

* Ignore warning in tests

* Set lazy loading to false

* Add codeowner

* host and port read only (#156)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* host and port read only

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

* [develop < T0094-GA] Variable support for node and edge properties (#154)

* added functionality and tests

* add docstring

* add test for relationship

* black

* migrated check to to_cypher_value

* community fixes

* change test names

* type checking

* renamed variable value to name

* new connection private method (#157)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* new connection private method

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

* [develop < T0074-GA] Remove sudo from instance_runner (#148)

* Remove sudo

* Remove unused import

* exceptions fixed (#153)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* exceptions fixed

* fixed stream tests

* reformatting

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* exceptions fixed

* fixed stream tests

* reformatting

* rebased

* exceptions fixed

* reformatting

* renamed

* fixed

* Added new line

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

* moved integrated algorithms (#147)

* Add lazy argument to Memgraph (#159)

* [develop < T0098-GA] Add datetime support (#161)

* Add datetime support

* Change value_type to value

* Add new tests

* Format timedelta and add datetime tests

* Add datetimeKwMapping and change call to one-liner

* Fix flake8

* Fix import formatting

Co-authored-by: g-despot <[email protected]>

* changed string variables for Blob and S3 kwargs (#151)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* changed string variables for Blob and S3 kwargs

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

* Add example in docstring and docs test

Co-authored-by: Ivan Despot <[email protected]>
Co-authored-by: Bruno Sačarić <[email protected]>
Co-authored-by: Boris Taševski <[email protected]>
Co-authored-by: Boris Tasevski <[email protected]>
Co-authored-by: g-despot <[email protected]>
Co-authored-by: niko4299 <[email protected]>

* fix bad query in save_relationship_with_id (#166)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* fix bad query in save_relationship_with_id

Fixes the error in the cypher query of memgraph.save_relationship_with_id() caused by an unbound variable in the return statement.

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

* [develop <  T0089-GA] Create Operator Enum (#165)

* Add WhereOperator enum and update tests

* Add exceptions if str value is wrong

* Change to Operator

* fix bad query in save_relationship_with_id (#166)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* fix bad query in save_relationship_with_id

Fixes the error in the cypher query of memgraph.save_relationship_with_id() caused by an unbound variable in the return statement.

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

Co-authored-by: Daniel <[email protected]>
Co-authored-by: g-despot <[email protected]>

* [develop < T0066-GA] Add foreach to query builder (#135)

* foreach using another query_builder for update_clause

* add comment

* added base class

* added functionality and tests

* add docstring

* add test for relationship

* black

* migrated check to to_cypher_value

* community fixes

* change test names

* type checking

* make tests work good

* black format

* Update docstring

Co-authored-by: Katarina Supe <[email protected]>

* non double negative logic

* done did double negation fix

* add Set[str]

* add set[str]

* missing parantheses

* added Set import

* black format

* Add minor changes

* add example and kwarg names

* formatting, renamed update_clauses to update_clause

* removed checking None in properties

Co-authored-by: Katarina Supe <[email protected]>
Co-authored-by: Ivan Despot <[email protected]>

* [develop < T0093] Add query module arguments as tuples (#155)

* Added arguments of query modules as tuples

* Replaced foreach argument x for arg

* Added another test with query procedures as tuples

* Flake corrected and poetry

* Added parsing of qm arguments to utilities

* Removed self from utilities function

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

* [develop < T0106] fix @Property being optional when they are not (#167)

* I see no changes, wake up in the morning and I ask myself

* move None check to constructor

* [develop < T0103-GA] Add docstring examples (#162)

* Add docstring examples

* Add kwards

* Fix test union typo

* Update set docstring examples + add execute

* Update to Operator in examples

* Update skip and limit arguments

* fix bad query in save_relationship_with_id (#166)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* fix bad query in save_relationship_with_id

Fixes the error in the cypher query of memgraph.save_relationship_with_id() caused by an unbound variable in the return statement.

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

* [develop <  T0089-GA] Create Operator Enum (#165)

* Add WhereOperator enum and update tests

* Add exceptions if str value is wrong

* Change to Operator

* fix bad query in save_relationship_with_id (#166)

* Update bug_report.md

* [master <  T0068-GA] Update README (#136)

* Update README

* Fix broken link

* Move emojis

* Add table to title

* fix bad query in save_relationship_with_id

Fixes the error in the cypher query of memgraph.save_relationship_with_id() caused by an unbound variable in the return statement.

Co-authored-by: g-despot <[email protected]>
Co-authored-by: Katarina Supe <[email protected]>

Co-authored-by: Daniel <[email protected]>
Co-authored-by: g-despot <[email protected]>

* Minor language fixes

Co-authored-by: Daniel <[email protected]>
Co-authored-by: g-despot <[email protected]>

* [develop < T0067] Sync push stream query modules (#158)

* Added query modules from gqlalchemy

* with kafka stream

* fixed

* test

* added stream module loading

* Added query modules from gqlalchemy

* with kafka stream

* fixed

* test

* added stream module loading

* added tests

* poetry fixed

* something wrong with test

* test still not fixed, execute and fetch problem

* fixed tests

* Added query modules from gqlalchemy

* with kafka stream

* fixed

* test

* added stream module loading

* added tests

* Added query modules from gqlalchemy

* with kafka stream

* fixed

* test

* added stream module loading

* poetry fixed

* something wrong with test

* test still not fixed, execute and fetch problem

* fixed tests

* toml

* test hopefully fixed

* Added return type for integrations with query modules

* Rename gqlalchemy error handler to database error handler

* Formatting

* Made add_query_module as a public method so users can add their own query modules to Memgraph

* Update docstring for adding query modules

* Renamed test file

* Made add_query_module function public in tests

* Function correction

* Formatting

* fixed tests

* reformated

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

* [T0093 < T0096] Wrap MAGE query modules for autocompletion (#168)

* Added arguments of query modules as tuples

* Added modules in Memgraph query builder

* Added modules for memgraph mage

* Replaced foreach argument x for arg

* Added another test with query procedures as tuples

* Flake corrected and poetry

* Added parsing of qm arguments to utilities

* Removed self from utilities function

* Written tests to see if every method in code is present in Memgraph

* Assert reverse case, that every memgraph query module is written inside code

* Updated documentation for Mage query builder

* Formatting

* Imports from 3rd party libraries go before gqlalchemy

* Format imports

* Add networkx to github workflows

* Add networkx to github workflows attempt 2

* Add networkx to github workflows attempt 3

* Add networkx to github workflows attempt 4

* Add networkx to github workflows attempt 5

* Add networkx to github workflows attempt 6

* Add networkx to github workflows attempt 7

* Add networkx to github workflows attempt 8

* Add numpy to installed packages

* Addded scipy to installed packages

* Corrected Sudo command to sudo

* Removed sudo completely from the windows github workflows

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

* [develop < T0091-GA] Add support for Neo4j (#149)

* Add Neo4j OGM support

* Update workflow

* Update workflow

* Update workflow

* Refactor code

* Refactor code

* Fix ensure_indexes()

* Refactor code

* Add Neo4j tests for query builder

* Refactor query builder and tests

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Refactor query builder tests

* Replace Connection objects with Database

* Reorder imports

* Update docstrings and database arguments

* Remove unused import

* Add merge related updates

* Refactor code and address comments

* Fix poetry.lock

* Fix poetry.lock

* Fix dependencies

* Fix pip installation for Memgraph

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* [develop < T0099 GA] replace relative imports (#160)

* first step

* first try

* try

* absolute in init

* all gqlalchemy/ absolutes

* Reorder and group imports

* Reorder imports

* return of the Operator

* PEP8 standard

* fix import error (lol)

* Installing networkx with windows workflow

* remove duplicate import

Co-authored-by: Ivan Despot <[email protected]>
Co-authored-by: g-despot <[email protected]>
Co-authored-by: josipmrden <[email protected]>

* [develop < T0100-GA] Wait for Active Connection (#164)

* Implemented wait for connection; Tests pending

* wait for connection completed; code refactoring done

* merge error

* formatting errors fixed

* minor update

* rename variable

* formatting error fixed

* docstring added

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

* [develop < ] Rename relationship type argument (#171)

* renamed labels to type

* renamed to not conflict with PartialQuery type

* Update README (#169)

* [develop < T0109-GA] Remove excess Iterable type (#172)

* Update arg type

* Remove unused imports

* [develop < ] Rename relationship type argument (#171)

* renamed labels to type

* renamed to not conflict with PartialQuery type

* Update README (#169)

Co-authored-by: Bruno Sačarić <[email protected]>

* [master < T0107-GA] Update docs generation (#170)

* Update docs generation

* Update documentation

* Release GQLAlchemy 1.3

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]>
Co-authored-by: niko4299 <[email protected]>
Co-authored-by: Daniel <[email protected]>
Co-authored-by: Josipmrden <[email protected]>
Co-authored-by: josipmrden <[email protected]>
  • Loading branch information
12 people authored Jun 14, 2022
1 parent 0c7cf5b commit abbee73
Show file tree
Hide file tree
Showing 81 changed files with 9,321 additions and 3,233 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @g-despot @Josipmrden @BorisTasevski @katarinasupe @brunos252
* @g-despot @Josipmrden @BorisTasevski @katarinasupe @brunos252 @niko4299
75 changes: 62 additions & 13 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build and Test

env:
MG_VERSION: "2.1.1"
MG_VERSION: "2.3.0"
POETRY_VERSION: "1.1.4"

on:
Expand All @@ -23,25 +23,39 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.py-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up pip and install packages
run: |
python -m pip install -U pip
sudo -H pip install networkx numpy scipy
- name: Setup poetry
uses: abatilo/[email protected]
with:
poetry-version: ${{ env.POETRY_VERSION }}
- 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
mkdir /home/runner/memgraph
curl -L https://download.memgraph.com/memgraph/v${{env.MG_VERSION}}/ubuntu-20.04/memgraph_${{env.MG_VERSION}}-1_amd64.deb --output /home/runner/memgraph/memgraph-community.deb
sudo dpkg -i /home/runner/memgraph/memgraph-community.deb
sudo systemctl stop memgraph
sudo runuser -l memgraph -c '/usr/lib/memgraph/memgraph --bolt-port 7687 --bolt-session-inactivity-timeout=300 --data-directory="/var/lib/memgraph/data" --storage-properties-on-edges=true --storage-snapshot-interval-sec=0 --storage-wal-enabled=false --storage-recover-on-startup=false --storage-snapshot-on-exit=false --telemetry-enabled=false --log-level=TRACE --also-log-to-stderr=true --log-file=/var/log/memgraph/memgraph-ubuntu-${{ matrix.python-version }}.log' &
sleep 1 # Wait for Memgraph a bit.
- name: Install Neo4j
run: |
docker run -p 7474:7474 -p 7688:7687 -d -v $HOME/neo4j/data:/data -v $HOME/neo4j/logs:/logs -v $HOME/neo4j/import:/var/lib/neo4j/import -v $HOME/neo4j/plugins:/plugins --env NEO4J_AUTH=neo4j/test neo4j:4.4.7
- 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"
- name: Use the Upload Artifact GitHub Action
uses: actions/upload-artifact@v3
if: always()
with:
name: assets-for-download
path: /var/log/memgraph

build_and_test_windows:
if: github.event.pull_request.draft == false
Expand All @@ -53,21 +67,44 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.py-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up pip and install packages
run: |
python -m pip install -U pip
python -m pip install networkx numpy scipy
- uses: Vampire/setup-wsl@v1
with:
distribution: Ubuntu-20.04
- name: Download, install and run Memgraph under WSL
shell: wsl-bash {0} # root shell
run: |
mkdir ~/memgraph
curl -L https://download.memgraph.com/memgraph/v${{env.MG_VERSION}}/ubuntu-20.04/memgraph_${{env.MG_VERSION}}-1_amd64.deb --output ~/memgraph/memgraph-community.deb
dpkg -i ~/memgraph/memgraph-community.deb
nohup /usr/lib/memgraph/memgraph --bolt-port 7687 --data-directory="~/memgraph/data" --storage-properties-on-edges=true --storage-snapshot-interval-sec=0 --storage-wal-enabled=false --storage-recover-on-startup=false --storage-snapshot-on-exit=false --telemetry-enabled=false --log-file='' &
sudo apt-get update
sudo apt-get -y install python3 python3-pip ipython3
pip3 install networkx numpy scipy
mkdir /memgraph
curl -L https://download.memgraph.com/memgraph/v${{env.MG_VERSION}}/ubuntu-20.04/memgraph_${{env.MG_VERSION}}-1_amd64.deb --output /memgraph/memgraph-community.deb
dpkg -i /memgraph/memgraph-community.deb
mkdir /mnt/c/memgraph
runuser -l memgraph -c '/usr/lib/memgraph/memgraph --bolt-port 7687 --bolt-session-inactivity-timeout=300 --data-directory="/mnt/c/memgraph/data" --storage-properties-on-edges=true --storage-snapshot-interval-sec=0 --storage-wal-enabled=false --storage-recover-on-startup=false --storage-snapshot-on-exit=false --telemetry-enabled=false --log-level=TRACE --also-log-to-stderr=true --log-file=/mnt/c/memgraph/memgraph-windows-${{ matrix.python-version }}.log' &
sleep 1 # Wait for Memgraph a bit.
- name: Download, install and run Neo4j under WSL
shell: wsl-bash {0} # root shell
run: |
curl -fsSL https://debian.neo4j.com/neotechnology.gpg.key | apt-key add -
add-apt-repository "deb https://debian.neo4j.com stable 4.2"
sudo apt-get -y install neo4j=1:4.2.1
neo4j-admin set-initial-password test
mkdir -p /mnt/c/neo4j/${{ matrix.python-version }}
sed -i 's/#dbms.connector.bolt.listen_address=:7687/dbms.connector.bolt.listen_address=:7688/g' /etc/neo4j/neo4j.conf
sed -i 's/#dbms.connector.bolt.advertised_address=:7687/dbms.connector.bolt.advertised_address=:7688/g' /etc/neo4j/neo4j.conf
sed -i 's/#dbms.default_listen_address=0.0.0.0/dbms.default_listen_address=0.0.0.0/g' /etc/neo4j/neo4j.conf
sed -i 's/dbms.directories.logs=\/var\/log\/neo4j/dbms.directories.logs=\/mnt\/c\/neo4j\/${{ matrix.python-version }}/g' /etc/neo4j/neo4j.conf
cp /etc/neo4j/neo4j.conf /mnt/c/neo4j/${{ matrix.python-version }}/neo4j.conf
sudo service neo4j start
sleep 10 # Wait for Neo4j a bit.
- name: Setup poetry
uses: abatilo/[email protected]
with:
Expand All @@ -76,3 +113,15 @@ jobs:
run: |
poetry install
poetry run pytest -vvv -m "not slow and not ubuntu and not docker"
- name: Save Memgraph Logs
uses: actions/upload-artifact@v3
if: always()
with:
name: memgraph-log
path: C:\memgraph
- name: Save Neo4j Logs
uses: actions/upload-artifact@v3
if: always()
with:
name: neo4j-log
path: C:\neo4j
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,20 @@ When building a Cypher query, you can use a set of methods that are wrappers aro

```python
from gqlalchemy import create, match
from gqlalchemy.query_builder import Operator

query_create = create()
.node(labels="Person", name="Leslie")
.to(edge_label="FRIENDS_WITH")
.to(relationship_type="FRIENDS_WITH")
.node(labels="Person", name="Ron")
.execute()

query_match = match()
.node(labels="Person", variable="p1")
.to()
.node(labels="Person", variable="p2")
.where(item="p1.name", operator="=", literal="Leslie")
.return_({"p1":"p1"})
.where(item="p1.name", operator=Operator.EQUAL, literal="Leslie")
.return_(results=["p1", ("p2", "second")])
.execute()
```
</details>
Expand Down
166 changes: 166 additions & 0 deletions docs/reference/gqlalchemy/graph_algorithms/integrated_algorithms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
---
sidebar_label: integrated_algorithms
title: gqlalchemy.graph_algorithms.integrated_algorithms
---

## IntegratedAlgorithm Objects

```python
class IntegratedAlgorithm(ABC)
```

Abstract class modeling Memgraph&#x27;s built-in graph algorithms.

These algorithms are integrated into Memgraph&#x27;s codebase and are called
within a relationship part of a query. For instance:
MATCH p = (:City {name: &quot;Paris&quot;})
-[:Road * bfs (r, n | r.length &lt;= 200 AND n.name != &quot;Metz&quot;)]-&gt;
(:City {name: &quot;Berlin&quot;})

#### \_\_str\_\_

```python
@abstractmethod
def __str__() -> str
```

Instance of IntegratedAlgorithm subclass is used as a string

#### to\_cypher\_lambda

```python
@staticmethod
def to_cypher_lambda(expression: str) -> str
```

Method for creating a general lambda expression.

Variables `r` and `n` stand for relationship and node. The expression is
used e.g. for a filter lambda, to use only relationships of length less
than 200:
expression=&quot;r.length &lt; 200&quot;
with the filter lambda being:
(r, n | r.length &lt; 200)

**Arguments**:

- `expression` - Lambda conditions or statements.

## BreadthFirstSearch Objects

```python
class BreadthFirstSearch(IntegratedAlgorithm)
```

Build a BFS call for a Cypher query.

The Breadth-first search can be called in Memgraph with Cypher queries such
as: `MATCH (a {id: 723})-[*BFS ..10 (r, n | r.x &gt; 12 AND n.y &lt; 3)]-() RETURN *;`
It is called inside the relationship clause, `*BFS` naming the algorithm,
`..10` specifying depth bounds, and `(r, n | &lt;expression&gt;)` is a filter
lambda.

#### \_\_init\_\_

```python
def __init__(lower_bound: int = None, upper_bound: int = None, condition: str = None) -> None
```

**Arguments**:

- `lower_bound` - Lower bound for path depth. Defaults to `None`.
- `upper_bound` - Upper bound for path depth. Defaults to `None`.
- `condition` - Filter through nodes and relationships that pass this
condition. Defaults to `None`.

#### \_\_str\_\_

```python
def __str__() -> str
```

Get a Cypher query string for this algorithm.

#### to\_cypher\_bounds

```python
def to_cypher_bounds() -> str
```

If bounds are specified, returns them in grammar-defined form.

## DepthFirstSearch Objects

```python
class DepthFirstSearch(IntegratedAlgorithm)
```

Build a DFS call for a Cypher query.
The Depth-First Search can be called in Memgraph with Cypher queries
such as:
MATCH (a {id: 723})-[* ..10 (r, n | r.x &gt; 12 AND n.y &lt; 3)]-() RETURN *;
It is called inside the relationship clause, &quot;*&quot; naming the algorithm
(&quot;*&quot; without &quot;DFS&quot; because it is defined like such in openCypher),
&quot;..10&quot; specifying depth bounds, and &quot;(r, n | &lt;expression&gt;)&quot; is a filter
lambda.

#### \_\_init\_\_

```python
def __init__(lower_bound: int = None, upper_bound: int = None, condition: str = None) -> None
```

**Arguments**:

- `lower_bound` - Lower bound for path depth. Defaults to None.
- `upper_bound` - Upper bound for path depth. Defaults to None.
- `condition` - Filter through nodes and relationships that pass this
condition. Defaults to None.

#### \_\_str\_\_

```python
def __str__() -> str
```

get Cypher query string for this algorithm.

#### to\_cypher\_bounds

```python
def to_cypher_bounds() -> str
```

If bounds are specified, returns them in grammar-defined form.

## WeightedShortestPath Objects

```python
class WeightedShortestPath(IntegratedAlgorithm)
```

Build a Djikstra shortest path call for a Cypher query
The weighted shortest path algorithm can be called in Memgraph with Cypher
queries such as:
&quot; MATCH (a {id: 723})-[r *WSHORTEST 10 (r, n | r.weight) weight_sum
(r, n | r.x &gt; 12 AND r.y &lt; 3)]-(b {id: 882}) RETURN * &quot;
It is called inside the relationship clause, &quot;*WSHORTEST&quot; naming the
algorithm, &quot;10&quot; specifying search depth bounds, and &quot;(r, n | &lt;expression&gt;)&quot;
is a filter lambda, used to filter which relationships and nodes to use.

#### \_\_init\_\_

```python
def __init__(upper_bound: int = None, condition: str = None, total_weight_var: str = DEFAULT_TOTAL_WEIGHT, weight_property: str = DEFAULT_WEIGHT_PROPERTY) -> None
```

**Arguments**:

- `upper_bound` - Upper bound for path depth. Defaults to None.
- `condition` - Filter through nodes and relationships that pass this
condition. Defaults to None.
- `total_weight_var` - Variable defined as the sum of all weights on
path being returned. Defaults to &quot;total_weight&quot;.
- `weight_property` - property being used as weight. Defaults to
&quot;r.weight&quot;.

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

## MemgraphQueryBuilder Objects

```python
class MemgraphQueryBuilder(QueryBuilder)
```

This query builder extends the usual Cypher query builder capabilities with Memgraph&#x27;s query modules.
User gets with this module autocomplete features of graph algorithms.
Documentation on the methods can be found on Memgraph&#x27;s web page.

## MageQueryBuilder Objects

```python
class MageQueryBuilder(MemgraphQueryBuilder)
```

This query builder extends the Memgraph query builder with Memgraph MAGE graph algorithm Cypher options.
User gets with this module autocomplete features of graph algorithms written in MAGE library.
Documentation on the methods can be found on Memgraph&#x27;s web page.

Loading

0 comments on commit abbee73

Please sign in to comment.