A declarative query language for data processing pipelines
Project description
FlowQuery Python Implementation
This is the Python implementation of FlowQuery, a declarative query language for data processing pipelines.
Installation
From Source
git clone https://github.com/microsoft/FlowQuery.git
cd FlowQuery/flowquery-py
pip install -e .
With Development Dependencies
pip install -e ".[dev]"
Quick Start
Command Line Interface
After installation, you can start the interactive REPL:
flowquery
Using Conda (Alternative)
Windows (PowerShell):
cd flowquery-py
.\setup_env.ps1
conda activate flowquery
Linux/macOS:
cd flowquery-py
chmod +x setup_env.sh
./setup_env.sh
conda activate flowquery
The setup scripts automatically:
- Read the Python version from
pyproject.toml - Create a conda environment named
flowquery - Install the package with all dev dependencies
Requirements
- Python 3.10+ (defined in
pyproject.toml) - pytest (for running tests)
- pytest-asyncio (for async test support)
- aiohttp (for HTTP requests)
All dependencies are managed in pyproject.toml.
Programmatic Usage
import asyncio
from flowquery import Runner
runner = Runner("WITH 1 as x RETURN x + 1 as result")
asyncio.run(runner.run())
print(runner.results) # [{'result': 2}]
Running Tests
pytest tests/
Project Structure
flowquery-py/
├── pyproject.toml # Dependencies & project config (single source of truth)
├── setup_env.ps1 # Windows conda setup script
├── setup_env.sh # Linux/macOS conda setup script
├── README.md
├── src/
│ ├── __init__.py # Main package entry point
│ ├── extensibility.py # Public API for custom functions
│ ├── compute/
│ │ └── runner.py # Query execution engine
│ ├── graph/
│ │ ├── node.py # Graph node representation
│ │ ├── relationship.py # Graph relationship representation
│ │ ├── pattern.py # Pattern matching
│ │ └── database.py # In-memory graph database
│ ├── io/
│ │ └── command_line.py # Interactive REPL
│ ├── parsing/
│ │ ├── parser.py # Main parser
│ │ ├── ast_node.py # AST node base class
│ │ ├── expressions/ # Expression types (numbers, strings, operators)
│ │ ├── functions/ # Built-in and custom functions
│ │ ├── operations/ # Query operations (WITH, RETURN, UNWIND, etc.)
│ │ ├── components/ # LOAD clause components
│ │ ├── data_structures/ # Arrays, objects, lookups
│ │ └── logic/ # CASE/WHEN/THEN/ELSE
│ ├── tokenization/
│ │ ├── tokenizer.py # Lexer
│ │ ├── token.py # Token class
│ │ └── ... # Token types and mappers
│ └── utils/
│ ├── string_utils.py # String manipulation utilities
│ └── object_utils.py # Object utilities
└── tests/
├── test_extensibility.py
├── compute/
│ └── test_runner.py
├── graph/
│ ├── test_create.py
│ ├── test_data.py
│ └── test_match.py
├── parsing/
│ ├── test_parser.py
│ ├── test_context.py
│ └── test_expression.py
└── tokenization/
├── test_tokenizer.py
├── test_token_mapper.py
└── test_trie.py
Creating Custom Functions
from flowquery.extensibility import Function, FunctionDef
@FunctionDef({
"description": "Converts a string to uppercase",
"category": "string",
"parameters": [
{"name": "text", "description": "String to convert", "type": "string"}
],
"output": {"description": "Uppercase string", "type": "string"}
})
class UpperCase(Function):
def __init__(self):
super().__init__("uppercase")
self._expected_parameter_count = 1
def value(self) -> str:
return str(self.get_children()[0].value()).upper()
License
MIT License - see LICENSE for details.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flowquery-1.0.0.tar.gz.
File metadata
- Download URL: flowquery-1.0.0.tar.gz
- Upload date:
- Size: 54.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02f9667934a87733add7261935f408358feb34e5cb3a55bf67e6c44e0db941f0
|
|
| MD5 |
cd3e47fe4eb31790d311b300180165ef
|
|
| BLAKE2b-256 |
f50ab0dc751d3ffc5833056fee11b5cda8e6a5202ee801bacbfe669a3067a3d2
|
File details
Details for the file flowquery-1.0.0-py3-none-any.whl.
File metadata
- Download URL: flowquery-1.0.0-py3-none-any.whl
- Upload date:
- Size: 90.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68f988aba895c28d6f4d2501e0640159b9ad11ad4e8e6f6138a965031c6db8d8
|
|
| MD5 |
9c6555032406cfd68c4b624d077ec7ab
|
|
| BLAKE2b-256 |
ff67743a70bb6ad71318af19b81ae7fd30ad1c8a1ba9d3bd37ec9de37a32a894
|