@@ -24,12 +24,9 @@ For the latest documentation, see
2424
2525Install the library with ` pip install databricks-sql-connector `
2626
27- Note: Don't hard-code authentication secrets into your Python. Use environment variables
28-
2927``` bash
3028export DATABRICKS_HOST=******** .databricks.com
3129export DATABRICKS_HTTP_PATH=/sql/1.0/endpoints/****************
32- export DATABRICKS_TOKEN=dapi********************************
3330```
3431
3532Example usage:
@@ -39,12 +36,10 @@ from databricks import sql
3936
4037host = os.getenv(" DATABRICKS_HOST" )
4138http_path = os.getenv(" DATABRICKS_HTTP_PATH" )
42- access_token = os.getenv(" DATABRICKS_TOKEN" )
4339
4440connection = sql.connect(
4541 server_hostname = host,
46- http_path = http_path,
47- access_token = access_token)
42+ http_path = http_path)
4843
4944cursor = connection.cursor()
5045cursor.execute(' SELECT :param `p`, * FROM RANGE(10)' , {" param" : " foo" })
@@ -60,7 +55,10 @@ In the above example:
6055- ` server-hostname ` is the Databricks instance host name.
6156- ` http-path ` is the HTTP Path either to a Databricks SQL endpoint (e.g. /sql/1.0/endpoints/1234567890abcdef),
6257or to a Databricks Runtime interactive cluster (e.g. /sql/protocolv1/o/1234567890123456/1234-123456-slid123)
63- - ` personal-access-token ` is the Databricks Personal Access Token for the account that will execute commands and queries
58+
59+ > Note: This example uses [ Databricks OAuth U2M] ( https://docs.databricks.com/en/dev-tools/auth/oauth-u2m.html )
60+ > to authenticate the target Databricks user account and needs to open the browser for authentication. So it
61+ > can only run on the user's machine.
6462
6563
6664## Contributing
0 commit comments