-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding the option of using POST for queries in SPARQLStore #673
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the PR... slight change request:
i think this is more "stable" long term... might be interesting to have an automatic failover for too long GETs somewhen...
@@ -239,6 +239,7 @@ def __init__(self, | |||
sparql11=True, context_aware=True, | |||
node_to_sparql=_node_to_sparql, | |||
node_from_result=_node_from_result, | |||
query_as_post=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you rename this to default_query_method=GET
?
@@ -259,6 +260,7 @@ def __init__(self, | |||
self.context_aware = context_aware | |||
self.graph_aware = context_aware | |||
self._timeout = None | |||
self.query_as_post = query_as_post |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.query_method = default_query_method
@@ -322,6 +324,7 @@ def query(self, query, | |||
" ".join(self.node_to_sparql(initBindings[x]) for x in v)) | |||
|
|||
self.resetQuery() | |||
self.setMethod(POST if self.query_as_post else GET) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.setMethod(self.query_method)
Yeah having something automatic might be good for users, because the current error message is really not hepful right now (complains about a weird character). Also, it should be noted that this extension doesn't allow to make a POST query with the sparql query as POST data directly. By default it uses an URL_ENCODED scheme. Not sure if it might be useful at one point though. |
default is set on init, actual query method might be changed during exec
Solution to #672
Just adding a small parameter to be able to use POST for queries in order to to perform long requests.
Previously :
Now :
Tiny changes based on postAsEncoded param in SPARQLUpdateStore