Skip to content

Commit

Permalink
Merge branch 'feature/17/simplify-sinequa-constructor' of github.com:…
Browse files Browse the repository at this point in the history
…NASA-IMPACT/pynequa into feature/17/simplify-sinequa-constructor
  • Loading branch information
anisbhsl committed Oct 12, 2023
2 parents 534a418 + cab5208 commit 02ed110
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions pynequa/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class Sinequa(API):
base_url(str): base URL for hosted Sinequa instance
app_name(str): name of Sinequa app
query_name(str): name of search query web service
'''

def __init__(
Expand Down Expand Up @@ -404,8 +403,23 @@ def suggest_field(self):
endpoint = "suggestField"
pass

def engine_sql(self):
def engine_sql(self, sql: str, max_rows: int = 1000) -> Dict:
'''
This method runs classic SQL query on the database engine.
Args:
sql (str): Query to send
max_rows (int): Maximum number of rows a query can return (default: 1000)
Returns:
Dict: response for sql query
'''
endpoint = "engine.sql"
pass

payload = {
"sql": sql,
"maxRows": 1000,
"pretty": True,
"output": "json"
}

return self.post(endpoint=endpoint, payload=payload)

0 comments on commit 02ed110

Please sign in to comment.