-
Notifications
You must be signed in to change notification settings - Fork 114
Introduce SeaDatabricksClient
(Session Implementation)
#582
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
Conversation
b97b9be
to
6c6ec28
Compare
SeaDatabricksClient
(Session Implementation)
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
2e3d5d0
to
ed4931e
Compare
Have we tested this end to end locally? If yes, let's add that detail in the PR description |
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.
Minor comments. Rest LGTM
""" | ||
|
||
warehouse_pattern = re.compile(r".*/warehouses/(.+)") | ||
endpoint_pattern = re.compile(r".*/endpoints/(.+)") |
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.
do we have endpoints now? i don't think so
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.
The JDBC driver supports it.
Opens a new session with the Databricks SQL service using SEA. | ||
|
||
Args: | ||
session_configuration: Optional dictionary of configuration parameters for the session |
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.
right now only a select spark configs are allowed in DBSQL as session configs: https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-parameters
please document this appropriately. also, please test if server ignores any other arbitrary session config. if not, please include client-side checks/filtering
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, I added a link to the above doc in the doc-string.
I tested passing some arbitrary (un-supported) parameters in the session config and I did not get any warning or error from the server, so the server seems to ignore irrelevant params.
To be clear, this means we need not include any client side filtering, right?
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
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.
Minor comments
…ver endoints Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
What type of PR is this?
Description
open_session()
andclose_session()
functionality.How is this tested?
examples/experimental/sea_connector_test.py
in thesea-migration
branch contains a simple function that creates and closes a connection using theSEA
mode, effectively opening and closing a session using the SEA client. This was run, and verified to work.The coverage of the newly introduced
backend/sea
directory by the unit tests is as below:backend.py
from databricks.sql.client import Cursor
(TYPE_CHECKING import)models/__init__.py
models/requests.py
models/responses.py
utils/constants.py
utils/http_client.py
- Lines 44-80: SSL configuration in
__init__
- Lines 86-88:
_get_auth_headers
method- Lines 92-99:
_get_call
method- Lines 124-186: Error handling in
_make_request
methodNote: I intentionally did not add unit tests for the HTTP client because I do not expect it to change and it is for the short term. It has been indirectly tested as a part of the manual tests.
Related Tickets & Documents
https://docs.google.com/document/d/1Y-eXLhNqqhrMVGnOlG8sdFrCxBTN1GdQvuKG4IfHmo0/edit?usp=sharing
https://databricks.atlassian.net/browse/PECOBLR-482?atlOrigin=eyJpIjoiODdkMGQ5NjZhMjY5NDRmZWEwZmIyNGEyNzFlNGQxNzEiLCJwIjoiaiJ9