Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/bal_tools/pytest-8.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gosuto-inzasheru authored Dec 13, 2024
2 parents 53747cf + 39e561c commit cbea859
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
GRAPH_API_KEY: ${{ secrets.GRAPH_API_KEY }}
run: |
pip install -r bal_tools/requirements-dev.txt
pytest
pytest -x
11 changes: 7 additions & 4 deletions bal_tools/subgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ def fetch_graphql_data(
raise ValueError(
f"Subgraph url not found for {subgraph} on chain {self.chain}"
)

transport = RequestsHTTPTransport(
url=url or self.subgraph_url[subgraph],
retries=retries,
Expand All @@ -218,9 +217,13 @@ def fetch_graphql_data(
)
client = Client(transport=transport, fetch_schema_from_transport=False)

# retrieve the query from its file and execute it
with open(f"{graphql_base_path}/{subgraph}/{query}.gql") as f:
gql_query = gql(f.read())
if "{" and "}" in query:
# `query` is the actual query itself
gql_query = gql(query)
else:
# `query` is the filename; load it from the graphql folder
with open(f"{graphql_base_path}/{subgraph}/{query}.gql") as f:
gql_query = gql(f.read())
result = client.execute(gql_query, variable_values=params)

return result
Expand Down

0 comments on commit cbea859

Please sign in to comment.