Skip to content

Commit d7a882f

Browse files
author
Tristen Harr
committed
update to add variable support and add parallel execution
1 parent c608f14 commit d7a882f

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ This changelog documents the changes between release versions.
44
## [Unreleased]
55
Changes to be included in the next upcoming release
66

7+
## [0.0.36] - 2024-08-07
8+
* Add support for query variables
9+
* Add support for parallel query execution
10+
711
## [0.0.35] - 2024-08-05
812
* Update SDK to listen on IPV4 & IPV6
913

connector-definition/template/functions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from opentelemetry.trace import get_tracer # If you aren't planning on adding additional tracing spans, you don't need this either!
1313
from hasura_ndc.function_connector import FunctionConnector
1414
from pydantic import BaseModel # You only need this import if you plan to have complex inputs/outputs, which function similar to how frameworks like FastAPI do
15+
import asyncio # You might not need this import if you aren't doing asynchronous work
1516

1617
connector = FunctionConnector()
1718

@@ -92,6 +93,11 @@ async def do_some_async_work(_span):
9293
{"tracing-attr": "Additional attributes can be added to Otel spans by making use of with_active_span like this"}
9394
)
9495

96+
# This is an example of how to setup queries to be run in parallel
97+
@connector.register_query(parallel_degree=5) # When joining to this function, it will be executed in parallel in batches of 5
98+
async def parallel_query(name: str) -> str:
99+
await asyncio.sleep(1)
100+
return f"Hello {name}"
95101

96102
if __name__ == "__main__":
97103
start(connector)

connector-definition/template/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fastapi==0.110.2
99
googleapis-common-protos==1.63.0
1010
grpcio==1.62.2
1111
h11==0.14.0
12-
hasura-ndc==0.21
12+
hasura-ndc==0.22
1313
idna==3.7
1414
importlib-metadata==7.0.0
1515
opentelemetry-api==1.24.0

0 commit comments

Comments
 (0)