flowquery 1.0.4__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.
- flowquery-1.0.4/PKG-INFO +95 -0
- flowquery-1.0.4/README.md +67 -0
- flowquery-1.0.4/flowquery.egg-info/PKG-INFO +95 -0
- flowquery-1.0.4/flowquery.egg-info/SOURCES.txt +124 -0
- flowquery-1.0.4/flowquery.egg-info/dependency_links.txt +1 -0
- flowquery-1.0.4/flowquery.egg-info/entry_points.txt +2 -0
- flowquery-1.0.4/flowquery.egg-info/requires.txt +5 -0
- flowquery-1.0.4/flowquery.egg-info/top_level.txt +1 -0
- flowquery-1.0.4/pyproject.toml +75 -0
- flowquery-1.0.4/setup.cfg +4 -0
- flowquery-1.0.4/src/__init__.py +34 -0
- flowquery-1.0.4/src/__main__.py +10 -0
- flowquery-1.0.4/src/compute/__init__.py +5 -0
- flowquery-1.0.4/src/compute/runner.py +60 -0
- flowquery-1.0.4/src/extensibility.py +52 -0
- flowquery-1.0.4/src/graph/__init__.py +31 -0
- flowquery-1.0.4/src/graph/data.py +118 -0
- flowquery-1.0.4/src/graph/database.py +82 -0
- flowquery-1.0.4/src/graph/hops.py +43 -0
- flowquery-1.0.4/src/graph/node.py +112 -0
- flowquery-1.0.4/src/graph/node_data.py +26 -0
- flowquery-1.0.4/src/graph/node_reference.py +49 -0
- flowquery-1.0.4/src/graph/pattern.py +125 -0
- flowquery-1.0.4/src/graph/pattern_expression.py +62 -0
- flowquery-1.0.4/src/graph/patterns.py +42 -0
- flowquery-1.0.4/src/graph/physical_node.py +40 -0
- flowquery-1.0.4/src/graph/physical_relationship.py +36 -0
- flowquery-1.0.4/src/graph/relationship.py +135 -0
- flowquery-1.0.4/src/graph/relationship_data.py +33 -0
- flowquery-1.0.4/src/graph/relationship_match_collector.py +77 -0
- flowquery-1.0.4/src/graph/relationship_reference.py +21 -0
- flowquery-1.0.4/src/io/__init__.py +5 -0
- flowquery-1.0.4/src/io/command_line.py +67 -0
- flowquery-1.0.4/src/parsing/__init__.py +17 -0
- flowquery-1.0.4/src/parsing/alias.py +20 -0
- flowquery-1.0.4/src/parsing/alias_option.py +11 -0
- flowquery-1.0.4/src/parsing/ast_node.py +146 -0
- flowquery-1.0.4/src/parsing/base_parser.py +84 -0
- flowquery-1.0.4/src/parsing/components/__init__.py +19 -0
- flowquery-1.0.4/src/parsing/components/csv.py +8 -0
- flowquery-1.0.4/src/parsing/components/from_.py +10 -0
- flowquery-1.0.4/src/parsing/components/headers.py +12 -0
- flowquery-1.0.4/src/parsing/components/json.py +8 -0
- flowquery-1.0.4/src/parsing/components/null.py +10 -0
- flowquery-1.0.4/src/parsing/components/post.py +8 -0
- flowquery-1.0.4/src/parsing/components/text.py +8 -0
- flowquery-1.0.4/src/parsing/context.py +50 -0
- flowquery-1.0.4/src/parsing/data_structures/__init__.py +15 -0
- flowquery-1.0.4/src/parsing/data_structures/associative_array.py +41 -0
- flowquery-1.0.4/src/parsing/data_structures/json_array.py +30 -0
- flowquery-1.0.4/src/parsing/data_structures/key_value_pair.py +38 -0
- flowquery-1.0.4/src/parsing/data_structures/lookup.py +49 -0
- flowquery-1.0.4/src/parsing/data_structures/range_lookup.py +42 -0
- flowquery-1.0.4/src/parsing/expressions/__init__.py +57 -0
- flowquery-1.0.4/src/parsing/expressions/boolean.py +20 -0
- flowquery-1.0.4/src/parsing/expressions/expression.py +138 -0
- flowquery-1.0.4/src/parsing/expressions/expression_map.py +26 -0
- flowquery-1.0.4/src/parsing/expressions/f_string.py +27 -0
- flowquery-1.0.4/src/parsing/expressions/identifier.py +20 -0
- flowquery-1.0.4/src/parsing/expressions/number.py +32 -0
- flowquery-1.0.4/src/parsing/expressions/operator.py +169 -0
- flowquery-1.0.4/src/parsing/expressions/reference.py +47 -0
- flowquery-1.0.4/src/parsing/expressions/string.py +27 -0
- flowquery-1.0.4/src/parsing/functions/__init__.py +75 -0
- flowquery-1.0.4/src/parsing/functions/aggregate_function.py +60 -0
- flowquery-1.0.4/src/parsing/functions/async_function.py +62 -0
- flowquery-1.0.4/src/parsing/functions/avg.py +55 -0
- flowquery-1.0.4/src/parsing/functions/collect.py +75 -0
- flowquery-1.0.4/src/parsing/functions/function.py +68 -0
- flowquery-1.0.4/src/parsing/functions/function_factory.py +173 -0
- flowquery-1.0.4/src/parsing/functions/function_metadata.py +149 -0
- flowquery-1.0.4/src/parsing/functions/functions.py +59 -0
- flowquery-1.0.4/src/parsing/functions/join.py +47 -0
- flowquery-1.0.4/src/parsing/functions/keys.py +34 -0
- flowquery-1.0.4/src/parsing/functions/predicate_function.py +46 -0
- flowquery-1.0.4/src/parsing/functions/predicate_sum.py +47 -0
- flowquery-1.0.4/src/parsing/functions/rand.py +28 -0
- flowquery-1.0.4/src/parsing/functions/range_.py +34 -0
- flowquery-1.0.4/src/parsing/functions/reducer_element.py +15 -0
- flowquery-1.0.4/src/parsing/functions/replace.py +37 -0
- flowquery-1.0.4/src/parsing/functions/round_.py +32 -0
- flowquery-1.0.4/src/parsing/functions/size.py +32 -0
- flowquery-1.0.4/src/parsing/functions/split.py +47 -0
- flowquery-1.0.4/src/parsing/functions/stringify.py +47 -0
- flowquery-1.0.4/src/parsing/functions/sum.py +51 -0
- flowquery-1.0.4/src/parsing/functions/to_json.py +33 -0
- flowquery-1.0.4/src/parsing/functions/type_.py +47 -0
- flowquery-1.0.4/src/parsing/functions/value_holder.py +24 -0
- flowquery-1.0.4/src/parsing/logic/__init__.py +15 -0
- flowquery-1.0.4/src/parsing/logic/case.py +29 -0
- flowquery-1.0.4/src/parsing/logic/else_.py +12 -0
- flowquery-1.0.4/src/parsing/logic/end.py +8 -0
- flowquery-1.0.4/src/parsing/logic/then.py +12 -0
- flowquery-1.0.4/src/parsing/logic/when.py +10 -0
- flowquery-1.0.4/src/parsing/operations/__init__.py +35 -0
- flowquery-1.0.4/src/parsing/operations/aggregated_return.py +24 -0
- flowquery-1.0.4/src/parsing/operations/aggregated_with.py +22 -0
- flowquery-1.0.4/src/parsing/operations/call.py +74 -0
- flowquery-1.0.4/src/parsing/operations/create_node.py +34 -0
- flowquery-1.0.4/src/parsing/operations/create_relationship.py +34 -0
- flowquery-1.0.4/src/parsing/operations/group_by.py +130 -0
- flowquery-1.0.4/src/parsing/operations/limit.py +22 -0
- flowquery-1.0.4/src/parsing/operations/load.py +140 -0
- flowquery-1.0.4/src/parsing/operations/match.py +29 -0
- flowquery-1.0.4/src/parsing/operations/operation.py +69 -0
- flowquery-1.0.4/src/parsing/operations/projection.py +21 -0
- flowquery-1.0.4/src/parsing/operations/return_op.py +50 -0
- flowquery-1.0.4/src/parsing/operations/unwind.py +37 -0
- flowquery-1.0.4/src/parsing/operations/where.py +41 -0
- flowquery-1.0.4/src/parsing/operations/with_op.py +18 -0
- flowquery-1.0.4/src/parsing/parser.py +1011 -0
- flowquery-1.0.4/src/parsing/token_to_node.py +109 -0
- flowquery-1.0.4/src/tokenization/__init__.py +23 -0
- flowquery-1.0.4/src/tokenization/keyword.py +48 -0
- flowquery-1.0.4/src/tokenization/operator.py +29 -0
- flowquery-1.0.4/src/tokenization/string_walker.py +158 -0
- flowquery-1.0.4/src/tokenization/symbol.py +19 -0
- flowquery-1.0.4/src/tokenization/token.py +605 -0
- flowquery-1.0.4/src/tokenization/token_mapper.py +52 -0
- flowquery-1.0.4/src/tokenization/token_type.py +21 -0
- flowquery-1.0.4/src/tokenization/tokenizer.py +214 -0
- flowquery-1.0.4/src/tokenization/trie.py +124 -0
- flowquery-1.0.4/src/utils/__init__.py +6 -0
- flowquery-1.0.4/src/utils/object_utils.py +20 -0
- flowquery-1.0.4/src/utils/string_utils.py +113 -0
- flowquery-1.0.4/tests/test_extensibility.py +611 -0
flowquery-1.0.4/PKG-INFO
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flowquery
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: A declarative query language for data processing pipelines
|
|
5
|
+
Author: FlowQuery Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/microsoft/FlowQuery/flowquery-py
|
|
8
|
+
Project-URL: Repository, https://github.com/microsoft/FlowQuery/flowquery-py
|
|
9
|
+
Project-URL: Documentation, https://github.com/microsoft/FlowQuery/flowquery-py#readme
|
|
10
|
+
Project-URL: Issues, https://github.com/microsoft/FlowQuery/issues
|
|
11
|
+
Keywords: query,data-processing,pipeline,declarative
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Database :: Front-Ends
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: aiohttp>=3.8.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
28
|
+
|
|
29
|
+
# FlowQuery
|
|
30
|
+
|
|
31
|
+
A declarative query language for data processing pipelines.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install flowquery
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
### Command Line Interface
|
|
42
|
+
|
|
43
|
+
Start the interactive REPL:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
flowquery
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Programmatic Usage
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import asyncio
|
|
53
|
+
from flowquery import Runner
|
|
54
|
+
|
|
55
|
+
runner = Runner("WITH 1 as x RETURN x + 1 as result")
|
|
56
|
+
asyncio.run(runner.run())
|
|
57
|
+
print(runner.results) # [{'result': 2}]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Creating Custom Functions
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from flowquery.extensibility import Function, FunctionDef
|
|
64
|
+
|
|
65
|
+
@FunctionDef({
|
|
66
|
+
"description": "Converts a string to uppercase",
|
|
67
|
+
"category": "string",
|
|
68
|
+
"parameters": [
|
|
69
|
+
{"name": "text", "description": "String to convert", "type": "string"}
|
|
70
|
+
],
|
|
71
|
+
"output": {"description": "Uppercase string", "type": "string"}
|
|
72
|
+
})
|
|
73
|
+
class UpperCase(Function):
|
|
74
|
+
def __init__(self):
|
|
75
|
+
super().__init__("uppercase")
|
|
76
|
+
self._expected_parameter_count = 1
|
|
77
|
+
|
|
78
|
+
def value(self) -> str:
|
|
79
|
+
return str(self.get_children()[0].value()).upper()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Documentation
|
|
83
|
+
|
|
84
|
+
- [Full Documentation](https://github.com/microsoft/FlowQuery)
|
|
85
|
+
- [Contributing Guide](https://github.com/microsoft/FlowQuery/blob/main/flowquery-py/CONTRIBUTING.md)
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT License - see [LICENSE](https://github.com/microsoft/FlowQuery/blob/main/LICENSE) for details.
|
|
90
|
+
|
|
91
|
+
## Links
|
|
92
|
+
|
|
93
|
+
- [Homepage](https://github.com/microsoft/FlowQuery)
|
|
94
|
+
- [Repository](https://github.com/microsoft/FlowQuery)
|
|
95
|
+
- [Issues](https://github.com/microsoft/FlowQuery/issues)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# FlowQuery
|
|
2
|
+
|
|
3
|
+
A declarative query language for data processing pipelines.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install flowquery
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Command Line Interface
|
|
14
|
+
|
|
15
|
+
Start the interactive REPL:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
flowquery
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Programmatic Usage
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
import asyncio
|
|
25
|
+
from flowquery import Runner
|
|
26
|
+
|
|
27
|
+
runner = Runner("WITH 1 as x RETURN x + 1 as result")
|
|
28
|
+
asyncio.run(runner.run())
|
|
29
|
+
print(runner.results) # [{'result': 2}]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Creating Custom Functions
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from flowquery.extensibility import Function, FunctionDef
|
|
36
|
+
|
|
37
|
+
@FunctionDef({
|
|
38
|
+
"description": "Converts a string to uppercase",
|
|
39
|
+
"category": "string",
|
|
40
|
+
"parameters": [
|
|
41
|
+
{"name": "text", "description": "String to convert", "type": "string"}
|
|
42
|
+
],
|
|
43
|
+
"output": {"description": "Uppercase string", "type": "string"}
|
|
44
|
+
})
|
|
45
|
+
class UpperCase(Function):
|
|
46
|
+
def __init__(self):
|
|
47
|
+
super().__init__("uppercase")
|
|
48
|
+
self._expected_parameter_count = 1
|
|
49
|
+
|
|
50
|
+
def value(self) -> str:
|
|
51
|
+
return str(self.get_children()[0].value()).upper()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Documentation
|
|
55
|
+
|
|
56
|
+
- [Full Documentation](https://github.com/microsoft/FlowQuery)
|
|
57
|
+
- [Contributing Guide](https://github.com/microsoft/FlowQuery/blob/main/flowquery-py/CONTRIBUTING.md)
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT License - see [LICENSE](https://github.com/microsoft/FlowQuery/blob/main/LICENSE) for details.
|
|
62
|
+
|
|
63
|
+
## Links
|
|
64
|
+
|
|
65
|
+
- [Homepage](https://github.com/microsoft/FlowQuery)
|
|
66
|
+
- [Repository](https://github.com/microsoft/FlowQuery)
|
|
67
|
+
- [Issues](https://github.com/microsoft/FlowQuery/issues)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flowquery
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: A declarative query language for data processing pipelines
|
|
5
|
+
Author: FlowQuery Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/microsoft/FlowQuery/flowquery-py
|
|
8
|
+
Project-URL: Repository, https://github.com/microsoft/FlowQuery/flowquery-py
|
|
9
|
+
Project-URL: Documentation, https://github.com/microsoft/FlowQuery/flowquery-py#readme
|
|
10
|
+
Project-URL: Issues, https://github.com/microsoft/FlowQuery/issues
|
|
11
|
+
Keywords: query,data-processing,pipeline,declarative
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Database :: Front-Ends
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: aiohttp>=3.8.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
28
|
+
|
|
29
|
+
# FlowQuery
|
|
30
|
+
|
|
31
|
+
A declarative query language for data processing pipelines.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install flowquery
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
### Command Line Interface
|
|
42
|
+
|
|
43
|
+
Start the interactive REPL:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
flowquery
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Programmatic Usage
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import asyncio
|
|
53
|
+
from flowquery import Runner
|
|
54
|
+
|
|
55
|
+
runner = Runner("WITH 1 as x RETURN x + 1 as result")
|
|
56
|
+
asyncio.run(runner.run())
|
|
57
|
+
print(runner.results) # [{'result': 2}]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Creating Custom Functions
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from flowquery.extensibility import Function, FunctionDef
|
|
64
|
+
|
|
65
|
+
@FunctionDef({
|
|
66
|
+
"description": "Converts a string to uppercase",
|
|
67
|
+
"category": "string",
|
|
68
|
+
"parameters": [
|
|
69
|
+
{"name": "text", "description": "String to convert", "type": "string"}
|
|
70
|
+
],
|
|
71
|
+
"output": {"description": "Uppercase string", "type": "string"}
|
|
72
|
+
})
|
|
73
|
+
class UpperCase(Function):
|
|
74
|
+
def __init__(self):
|
|
75
|
+
super().__init__("uppercase")
|
|
76
|
+
self._expected_parameter_count = 1
|
|
77
|
+
|
|
78
|
+
def value(self) -> str:
|
|
79
|
+
return str(self.get_children()[0].value()).upper()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Documentation
|
|
83
|
+
|
|
84
|
+
- [Full Documentation](https://github.com/microsoft/FlowQuery)
|
|
85
|
+
- [Contributing Guide](https://github.com/microsoft/FlowQuery/blob/main/flowquery-py/CONTRIBUTING.md)
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT License - see [LICENSE](https://github.com/microsoft/FlowQuery/blob/main/LICENSE) for details.
|
|
90
|
+
|
|
91
|
+
## Links
|
|
92
|
+
|
|
93
|
+
- [Homepage](https://github.com/microsoft/FlowQuery)
|
|
94
|
+
- [Repository](https://github.com/microsoft/FlowQuery)
|
|
95
|
+
- [Issues](https://github.com/microsoft/FlowQuery/issues)
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
flowquery.egg-info/PKG-INFO
|
|
4
|
+
flowquery.egg-info/SOURCES.txt
|
|
5
|
+
flowquery.egg-info/dependency_links.txt
|
|
6
|
+
flowquery.egg-info/entry_points.txt
|
|
7
|
+
flowquery.egg-info/requires.txt
|
|
8
|
+
flowquery.egg-info/top_level.txt
|
|
9
|
+
src/__init__.py
|
|
10
|
+
src/__main__.py
|
|
11
|
+
src/extensibility.py
|
|
12
|
+
src/compute/__init__.py
|
|
13
|
+
src/compute/runner.py
|
|
14
|
+
src/graph/__init__.py
|
|
15
|
+
src/graph/data.py
|
|
16
|
+
src/graph/database.py
|
|
17
|
+
src/graph/hops.py
|
|
18
|
+
src/graph/node.py
|
|
19
|
+
src/graph/node_data.py
|
|
20
|
+
src/graph/node_reference.py
|
|
21
|
+
src/graph/pattern.py
|
|
22
|
+
src/graph/pattern_expression.py
|
|
23
|
+
src/graph/patterns.py
|
|
24
|
+
src/graph/physical_node.py
|
|
25
|
+
src/graph/physical_relationship.py
|
|
26
|
+
src/graph/relationship.py
|
|
27
|
+
src/graph/relationship_data.py
|
|
28
|
+
src/graph/relationship_match_collector.py
|
|
29
|
+
src/graph/relationship_reference.py
|
|
30
|
+
src/io/__init__.py
|
|
31
|
+
src/io/command_line.py
|
|
32
|
+
src/parsing/__init__.py
|
|
33
|
+
src/parsing/alias.py
|
|
34
|
+
src/parsing/alias_option.py
|
|
35
|
+
src/parsing/ast_node.py
|
|
36
|
+
src/parsing/base_parser.py
|
|
37
|
+
src/parsing/context.py
|
|
38
|
+
src/parsing/parser.py
|
|
39
|
+
src/parsing/token_to_node.py
|
|
40
|
+
src/parsing/components/__init__.py
|
|
41
|
+
src/parsing/components/csv.py
|
|
42
|
+
src/parsing/components/from_.py
|
|
43
|
+
src/parsing/components/headers.py
|
|
44
|
+
src/parsing/components/json.py
|
|
45
|
+
src/parsing/components/null.py
|
|
46
|
+
src/parsing/components/post.py
|
|
47
|
+
src/parsing/components/text.py
|
|
48
|
+
src/parsing/data_structures/__init__.py
|
|
49
|
+
src/parsing/data_structures/associative_array.py
|
|
50
|
+
src/parsing/data_structures/json_array.py
|
|
51
|
+
src/parsing/data_structures/key_value_pair.py
|
|
52
|
+
src/parsing/data_structures/lookup.py
|
|
53
|
+
src/parsing/data_structures/range_lookup.py
|
|
54
|
+
src/parsing/expressions/__init__.py
|
|
55
|
+
src/parsing/expressions/boolean.py
|
|
56
|
+
src/parsing/expressions/expression.py
|
|
57
|
+
src/parsing/expressions/expression_map.py
|
|
58
|
+
src/parsing/expressions/f_string.py
|
|
59
|
+
src/parsing/expressions/identifier.py
|
|
60
|
+
src/parsing/expressions/number.py
|
|
61
|
+
src/parsing/expressions/operator.py
|
|
62
|
+
src/parsing/expressions/reference.py
|
|
63
|
+
src/parsing/expressions/string.py
|
|
64
|
+
src/parsing/functions/__init__.py
|
|
65
|
+
src/parsing/functions/aggregate_function.py
|
|
66
|
+
src/parsing/functions/async_function.py
|
|
67
|
+
src/parsing/functions/avg.py
|
|
68
|
+
src/parsing/functions/collect.py
|
|
69
|
+
src/parsing/functions/function.py
|
|
70
|
+
src/parsing/functions/function_factory.py
|
|
71
|
+
src/parsing/functions/function_metadata.py
|
|
72
|
+
src/parsing/functions/functions.py
|
|
73
|
+
src/parsing/functions/join.py
|
|
74
|
+
src/parsing/functions/keys.py
|
|
75
|
+
src/parsing/functions/predicate_function.py
|
|
76
|
+
src/parsing/functions/predicate_sum.py
|
|
77
|
+
src/parsing/functions/rand.py
|
|
78
|
+
src/parsing/functions/range_.py
|
|
79
|
+
src/parsing/functions/reducer_element.py
|
|
80
|
+
src/parsing/functions/replace.py
|
|
81
|
+
src/parsing/functions/round_.py
|
|
82
|
+
src/parsing/functions/size.py
|
|
83
|
+
src/parsing/functions/split.py
|
|
84
|
+
src/parsing/functions/stringify.py
|
|
85
|
+
src/parsing/functions/sum.py
|
|
86
|
+
src/parsing/functions/to_json.py
|
|
87
|
+
src/parsing/functions/type_.py
|
|
88
|
+
src/parsing/functions/value_holder.py
|
|
89
|
+
src/parsing/logic/__init__.py
|
|
90
|
+
src/parsing/logic/case.py
|
|
91
|
+
src/parsing/logic/else_.py
|
|
92
|
+
src/parsing/logic/end.py
|
|
93
|
+
src/parsing/logic/then.py
|
|
94
|
+
src/parsing/logic/when.py
|
|
95
|
+
src/parsing/operations/__init__.py
|
|
96
|
+
src/parsing/operations/aggregated_return.py
|
|
97
|
+
src/parsing/operations/aggregated_with.py
|
|
98
|
+
src/parsing/operations/call.py
|
|
99
|
+
src/parsing/operations/create_node.py
|
|
100
|
+
src/parsing/operations/create_relationship.py
|
|
101
|
+
src/parsing/operations/group_by.py
|
|
102
|
+
src/parsing/operations/limit.py
|
|
103
|
+
src/parsing/operations/load.py
|
|
104
|
+
src/parsing/operations/match.py
|
|
105
|
+
src/parsing/operations/operation.py
|
|
106
|
+
src/parsing/operations/projection.py
|
|
107
|
+
src/parsing/operations/return_op.py
|
|
108
|
+
src/parsing/operations/unwind.py
|
|
109
|
+
src/parsing/operations/where.py
|
|
110
|
+
src/parsing/operations/with_op.py
|
|
111
|
+
src/tokenization/__init__.py
|
|
112
|
+
src/tokenization/keyword.py
|
|
113
|
+
src/tokenization/operator.py
|
|
114
|
+
src/tokenization/string_walker.py
|
|
115
|
+
src/tokenization/symbol.py
|
|
116
|
+
src/tokenization/token.py
|
|
117
|
+
src/tokenization/token_mapper.py
|
|
118
|
+
src/tokenization/token_type.py
|
|
119
|
+
src/tokenization/tokenizer.py
|
|
120
|
+
src/tokenization/trie.py
|
|
121
|
+
src/utils/__init__.py
|
|
122
|
+
src/utils/object_utils.py
|
|
123
|
+
src/utils/string_utils.py
|
|
124
|
+
tests/test_extensibility.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
flowquery
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "flowquery"
|
|
3
|
+
version = "1.0.4"
|
|
4
|
+
description = "A declarative query language for data processing pipelines"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = {text = "MIT"}
|
|
8
|
+
authors = [
|
|
9
|
+
{name = "FlowQuery Contributors"}
|
|
10
|
+
]
|
|
11
|
+
keywords = ["query", "data-processing", "pipeline", "declarative"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Topic :: Database :: Front-Ends",
|
|
22
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"aiohttp>=3.8.0",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
flowquery = "flowquery.io.command_line:main"
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/microsoft/FlowQuery/flowquery-py"
|
|
33
|
+
Repository = "https://github.com/microsoft/FlowQuery/flowquery-py"
|
|
34
|
+
Documentation = "https://github.com/microsoft/FlowQuery/flowquery-py#readme"
|
|
35
|
+
Issues = "https://github.com/microsoft/FlowQuery/issues"
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
dev = [
|
|
39
|
+
"pytest>=7.0.0",
|
|
40
|
+
"pytest-asyncio>=0.21.0",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[build-system]
|
|
44
|
+
requires = ["setuptools>=61.0"]
|
|
45
|
+
build-backend = "setuptools.build_meta"
|
|
46
|
+
|
|
47
|
+
[tool.setuptools.package-dir]
|
|
48
|
+
"flowquery" = "src"
|
|
49
|
+
"flowquery.compute" = "src/compute"
|
|
50
|
+
"flowquery.graph" = "src/graph"
|
|
51
|
+
"flowquery.io" = "src/io"
|
|
52
|
+
"flowquery.parsing" = "src/parsing"
|
|
53
|
+
"flowquery.parsing.components" = "src/parsing/components"
|
|
54
|
+
"flowquery.parsing.data_structures" = "src/parsing/data_structures"
|
|
55
|
+
"flowquery.parsing.expressions" = "src/parsing/expressions"
|
|
56
|
+
"flowquery.parsing.functions" = "src/parsing/functions"
|
|
57
|
+
"flowquery.parsing.logic" = "src/parsing/logic"
|
|
58
|
+
"flowquery.parsing.operations" = "src/parsing/operations"
|
|
59
|
+
"flowquery.tokenization" = "src/tokenization"
|
|
60
|
+
"flowquery.utils" = "src/utils"
|
|
61
|
+
|
|
62
|
+
[tool.setuptools]
|
|
63
|
+
packages = ["flowquery", "flowquery.compute", "flowquery.graph", "flowquery.io", "flowquery.parsing", "flowquery.parsing.components", "flowquery.parsing.data_structures", "flowquery.parsing.expressions", "flowquery.parsing.functions", "flowquery.parsing.logic", "flowquery.parsing.operations", "flowquery.tokenization", "flowquery.utils"]
|
|
64
|
+
|
|
65
|
+
[tool.pytest.ini_options]
|
|
66
|
+
minversion = "7.0"
|
|
67
|
+
asyncio_mode = "auto"
|
|
68
|
+
testpaths = ["tests"]
|
|
69
|
+
python_files = ["test_*.py"]
|
|
70
|
+
python_classes = ["Test*"]
|
|
71
|
+
python_functions = ["test_*"]
|
|
72
|
+
addopts = "-v --tb=short"
|
|
73
|
+
|
|
74
|
+
[tool.pytest-asyncio]
|
|
75
|
+
mode = "auto"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""
|
|
2
|
+
FlowQuery - A declarative query language for data processing pipelines.
|
|
3
|
+
|
|
4
|
+
This is the Python implementation of FlowQuery.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .compute.runner import Runner
|
|
8
|
+
from .io.command_line import CommandLine
|
|
9
|
+
from .parsing.parser import Parser
|
|
10
|
+
from .parsing.functions.function import Function
|
|
11
|
+
from .parsing.functions.aggregate_function import AggregateFunction
|
|
12
|
+
from .parsing.functions.async_function import AsyncFunction
|
|
13
|
+
from .parsing.functions.predicate_function import PredicateFunction
|
|
14
|
+
from .parsing.functions.reducer_element import ReducerElement
|
|
15
|
+
from .parsing.functions.function_metadata import (
|
|
16
|
+
FunctionDef,
|
|
17
|
+
FunctionMetadata,
|
|
18
|
+
FunctionCategory,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"Runner",
|
|
23
|
+
"CommandLine",
|
|
24
|
+
"Parser",
|
|
25
|
+
"Function",
|
|
26
|
+
"AggregateFunction",
|
|
27
|
+
"AsyncFunction",
|
|
28
|
+
"PredicateFunction",
|
|
29
|
+
"ReducerElement",
|
|
30
|
+
"FunctionDef",
|
|
31
|
+
"FunctionMetadata",
|
|
32
|
+
"FunctionCategory",
|
|
33
|
+
]
|
|
34
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Executes a FlowQuery statement and retrieves the results."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Optional
|
|
4
|
+
|
|
5
|
+
from ..parsing.ast_node import ASTNode
|
|
6
|
+
from ..parsing.operations.operation import Operation
|
|
7
|
+
from ..parsing.parser import Parser
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Runner:
|
|
11
|
+
"""Executes a FlowQuery statement and retrieves the results.
|
|
12
|
+
|
|
13
|
+
The Runner class parses a FlowQuery statement into an AST and executes it,
|
|
14
|
+
managing the execution flow from the first operation to the final return statement.
|
|
15
|
+
|
|
16
|
+
Example:
|
|
17
|
+
runner = Runner("WITH 1 as x RETURN x")
|
|
18
|
+
await runner.run()
|
|
19
|
+
print(runner.results) # [{ x: 1 }]
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
def __init__(
|
|
23
|
+
self,
|
|
24
|
+
statement: Optional[str] = None,
|
|
25
|
+
ast: Optional[ASTNode] = None
|
|
26
|
+
):
|
|
27
|
+
"""Creates a new Runner instance and parses the FlowQuery statement.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
statement: The FlowQuery statement to execute
|
|
31
|
+
ast: An already-parsed AST (optional)
|
|
32
|
+
|
|
33
|
+
Raises:
|
|
34
|
+
ValueError: If neither statement nor AST is provided
|
|
35
|
+
"""
|
|
36
|
+
if (statement is None or statement == "") and ast is None:
|
|
37
|
+
raise ValueError("Either statement or AST must be provided")
|
|
38
|
+
|
|
39
|
+
_ast = ast if ast is not None else Parser().parse(statement)
|
|
40
|
+
self._first: Operation = _ast.first_child()
|
|
41
|
+
self._last: Operation = _ast.last_child()
|
|
42
|
+
|
|
43
|
+
async def run(self) -> None:
|
|
44
|
+
"""Executes the parsed FlowQuery statement.
|
|
45
|
+
|
|
46
|
+
Raises:
|
|
47
|
+
Exception: If an error occurs during execution
|
|
48
|
+
"""
|
|
49
|
+
await self._first.initialize()
|
|
50
|
+
await self._first.run()
|
|
51
|
+
await self._first.finish()
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def results(self) -> List[Dict[str, Any]]:
|
|
55
|
+
"""Gets the results from the executed statement.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
The results from the last operation (typically a RETURN statement)
|
|
59
|
+
"""
|
|
60
|
+
return self._last.results
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""FlowQuery Extensibility API
|
|
2
|
+
|
|
3
|
+
This module provides all the exports needed to create custom FlowQuery functions.
|
|
4
|
+
|
|
5
|
+
Example:
|
|
6
|
+
from flowquery.extensibility import Function, FunctionDef
|
|
7
|
+
|
|
8
|
+
@FunctionDef({
|
|
9
|
+
'description': "Converts a string to uppercase",
|
|
10
|
+
'category': "string",
|
|
11
|
+
'parameters': [{'name': "text", 'description': "String to convert", 'type': "string"}],
|
|
12
|
+
'output': {'description': "Uppercase string", 'type': "string"}
|
|
13
|
+
})
|
|
14
|
+
class UpperCase(Function):
|
|
15
|
+
def __init__(self):
|
|
16
|
+
super().__init__("uppercase")
|
|
17
|
+
self._expected_parameter_count = 1
|
|
18
|
+
|
|
19
|
+
def value(self) -> str:
|
|
20
|
+
return str(self.get_children()[0].value()).upper()
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
# Base function classes for creating custom functions
|
|
24
|
+
from .parsing.functions.function import Function
|
|
25
|
+
from .parsing.functions.aggregate_function import AggregateFunction
|
|
26
|
+
from .parsing.functions.async_function import AsyncFunction
|
|
27
|
+
from .parsing.functions.predicate_function import PredicateFunction
|
|
28
|
+
from .parsing.functions.reducer_element import ReducerElement
|
|
29
|
+
|
|
30
|
+
# Decorator and metadata types for function registration
|
|
31
|
+
from .parsing.functions.function_metadata import (
|
|
32
|
+
FunctionDef,
|
|
33
|
+
FunctionMetadata,
|
|
34
|
+
FunctionDefOptions,
|
|
35
|
+
ParameterSchema,
|
|
36
|
+
OutputSchema,
|
|
37
|
+
FunctionCategory,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"Function",
|
|
42
|
+
"AggregateFunction",
|
|
43
|
+
"AsyncFunction",
|
|
44
|
+
"PredicateFunction",
|
|
45
|
+
"ReducerElement",
|
|
46
|
+
"FunctionDef",
|
|
47
|
+
"FunctionMetadata",
|
|
48
|
+
"FunctionDefOptions",
|
|
49
|
+
"ParameterSchema",
|
|
50
|
+
"OutputSchema",
|
|
51
|
+
"FunctionCategory",
|
|
52
|
+
]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Graph module for FlowQuery."""
|
|
2
|
+
|
|
3
|
+
from .node import Node
|
|
4
|
+
from .relationship import Relationship
|
|
5
|
+
from .pattern import Pattern
|
|
6
|
+
from .patterns import Patterns
|
|
7
|
+
from .pattern_expression import PatternExpression
|
|
8
|
+
from .database import Database
|
|
9
|
+
from .hops import Hops
|
|
10
|
+
from .node_data import NodeData
|
|
11
|
+
from .node_reference import NodeReference
|
|
12
|
+
from .relationship_data import RelationshipData
|
|
13
|
+
from .relationship_reference import RelationshipReference
|
|
14
|
+
from .physical_node import PhysicalNode
|
|
15
|
+
from .physical_relationship import PhysicalRelationship
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"Node",
|
|
19
|
+
"Relationship",
|
|
20
|
+
"Pattern",
|
|
21
|
+
"Patterns",
|
|
22
|
+
"PatternExpression",
|
|
23
|
+
"Database",
|
|
24
|
+
"Hops",
|
|
25
|
+
"NodeData",
|
|
26
|
+
"NodeReference",
|
|
27
|
+
"RelationshipData",
|
|
28
|
+
"RelationshipReference",
|
|
29
|
+
"PhysicalNode",
|
|
30
|
+
"PhysicalRelationship",
|
|
31
|
+
]
|