Skip to content
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

bugfixes: create_query is_private field name & add optional arguments to run_sql() #103

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[MASTER]
disable=fixme,logging-fstring-interpolation
disable=fixme,logging-fstring-interpolation
[DESIGN]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are probably a few ignore statements that can now be removed.

max-args=10
6 changes: 4 additions & 2 deletions dune_client/api/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,17 @@ def run_sql(
params: Optional[list[QueryParameter]] = None,
is_private: bool = True,
archive_after: bool = True,
performance: Optional[str] = None,
name: str = "API Query",
) -> ResultsResponse:
"""
Allows user to provide execute raw_sql via the CRUD interface
- create, run, get results with optional archive/delete.
- Query is by default made private and archived after execution.
Requires premium subscription!
"""
query = self.create_query("API Query", query_sql, params, is_private)
results = self.run_query(query.base)
query = self.create_query(name, query_sql, params, is_private)
results = self.run_query(query=query.base, performance=performance)
if archive_after:
self.archive_query(query.base.query_id)
return results
Expand Down
2 changes: 1 addition & 1 deletion dune_client/api/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def create_query(
payload = {
"name": name,
"query_sql": query_sql,
"private": is_private,
"is_private": is_private,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should have a test, but this fix is correct

}
if params is not None:
payload["parameters"] = [p.to_dict() for p in params]
Expand Down
Loading