Skip to content

Commit

Permalink
Merge branch 'main' into ci/abort-pytest-on-fail
Browse files Browse the repository at this point in the history
  • Loading branch information
jalbrekt85 authored Dec 12, 2024
2 parents 5c9ca0f + fed4e0b commit 0442521
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ updates:
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "pip"
directory: "bal_tools/"
schedule:
interval: "daily"
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 0442521

Please sign in to comment.