Skip to content

Commit

Permalink
Merge branch 'master' into fix-hashlib-regression
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshg999 authored Oct 10, 2024
2 parents b1c52d2 + 961f7ea commit 58032db
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Binary file not shown.
5 changes: 5 additions & 0 deletions desktop/libs/notebook/src/notebook/connectors/trino.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ def _get_columns(self, database, table):
for col in columns
]

def get_log(self, notebook, snippet, startFrom=None, size=None):
guid = snippet['result']['handle']['guid'] if snippet.get('result') and snippet['result'].get('handle') and \
snippet['result']['handle'].get('guid') else None
return f"query_id: {guid}"

@query_error_handler
def explain(self, notebook, snippet):
statement = snippet['statement'].rstrip(';')
Expand Down
16 changes: 16 additions & 0 deletions desktop/libs/notebook/src/notebook/connectors/trino_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,19 @@ def test_auth_password_script(self, mock_default_password):
with patch('notebook.connectors.trino.coerce_password_from_script', return_value='custom_password_script'):
trino_api = TrinoApi(self.user, interpreter=interpreter)
assert trino_api.auth_password == 'custom_password_script'

def test_get_log(self):
notebook = {}
snippet = {
'result': {
'handle': {
'guid': '1234-abcd-5678-efgh'
}
}
}

# Expected result
expected_log = "query_id: 1234-abcd-5678-efgh"
result = self.trino_api.get_log(notebook, snippet)

assert result == expected_log

0 comments on commit 58032db

Please sign in to comment.