Skip to content

Commit

Permalink
Added pluggable python options
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Jun 28, 2018
1 parent b2111af commit 8e10925
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions graphql/backend/quiver_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
from six.moves.urllib.parse import urlparse

GRAPHQL_QUERY = """
mutation($schemaDsl: String!, $query: String!) {
mutation($schemaDsl: String!, $query: String!, $pythonOptions: PythonOptions) {
generateCode(
schemaDsl: $schemaDsl
query: $query,
language: PYTHON,
pythonOptions: {
asyncFramework: PROMISE
}
pythonOptions: $pythonOptions
) {
code
compilationTime
Expand Down Expand Up @@ -56,7 +54,7 @@ def __init__(self, dsn, python_options=None, **options):
self.secret_key = url.password
self.extra_namespace = {}
if python_options is None:
python_options = {}
python_options = {"asyncFramework": "PROMISE"}
wait_for_promises = python_options.pop("wait_for_promises", None)
if wait_for_promises:
assert callable(wait_for_promises), "wait_for_promises must be callable."
Expand All @@ -70,7 +68,11 @@ def make_post_request(self, url, auth, json_payload):
return response.json()

def generate_source(self, schema, query):
variables = {"schemaDsl": print_schema(schema), "query": query}
variables = {
"schemaDsl": print_schema(schema),
"query": query,
"pythonOptions": self.python_options,
}

json_response = self.make_post_request(
"{}/graphql".format(self.api_url),
Expand Down

0 comments on commit 8e10925

Please sign in to comment.