forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9e1db3
commit 0f58cf4
Showing
2 changed files
with
83 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,19 +9,93 @@ version: 1 | |
|
||
Supported trino version 352 and higher | ||
|
||
The [sqlalchemy-trino](https://pypi.org/project/sqlalchemy-trino/) library is the recommended way to connect to Trino through SQLAlchemy. | ||
### Connection String | ||
The connection string format is as follows: | ||
``` | ||
trino://{username}:{password}@{hostname}:{port}/{catalog} | ||
``` | ||
|
||
If you are running Trino with docker on local machine, please use the following connection URL | ||
``` | ||
trino://[email protected]:8080 | ||
``` | ||
|
||
### Authentications | ||
#### 1. Basic Authentication | ||
You can provide `username`/`password` in the connection string or in the `Secure Extra` field at `Advanced / Security` | ||
* In Connection String | ||
``` | ||
trino://{username}:{password}@{hostname}:{port}/{catalog} | ||
``` | ||
|
||
The expected connection string is formatted as follows: | ||
* In `Secure Extra` field | ||
```json | ||
{ | ||
"auth_method": "basic", | ||
"auth_params": { | ||
"username": "<username>", | ||
"password": "<password>" | ||
} | ||
} | ||
``` | ||
|
||
NOTE: if both are provided, `Secure Extra` always takes higher priority. | ||
|
||
#### 2. Kerberos Authentication | ||
In `Secure Extra` field, config as following example: | ||
```json | ||
{ | ||
"auth_method": "kerberos", | ||
"auth_params": { | ||
"service_name": "superset", | ||
"config": "/path/to/krb5.config", | ||
... | ||
} | ||
} | ||
``` | ||
trino://{username}:{password}@{hostname}:{port}/{catalog} | ||
|
||
All fields in `auth_params` are passed directly to the [`KerberosAuthentication`](https://github.com/trinodb/trino-python-client/blob/0.306.0/trino/auth.py#L40) class. | ||
|
||
#### 3. JWT Authentication | ||
Config `auth_method` and provide token in `Secure Extra` field | ||
```json | ||
{ | ||
"auth_method": "jwt", | ||
"auth_params": { | ||
"token": "<your-jwt-token>" | ||
} | ||
} | ||
``` | ||
|
||
If you are running trino with docker on local machine please use the following connection URL | ||
#### 4. Custom Authentication | ||
To use custom authentication, first you need to add it into | ||
`ALLOWED_EXTRA_AUTHENTICATIONS` allow list in Superset config file: | ||
```python | ||
from your.module import AuthClass | ||
from another.extra import auth_method | ||
|
||
ALLOWED_EXTRA_AUTHENTICATIONS: Dict[str, Dict[str, Callable[..., Any]]] = { | ||
"trino": { | ||
"custom_auth": AuthClass, | ||
"another_auth_method": auth_method, | ||
}, | ||
} | ||
``` | ||
trino://[email protected]:8080 | ||
|
||
Then in `Secure Extra` field: | ||
```json | ||
{ | ||
"auth_method": "custom_auth", | ||
"auth_params": { | ||
... | ||
} | ||
} | ||
``` | ||
|
||
Reference: | ||
[Trino-Superset-Podcast](https://trino.io/episodes/12.html) | ||
You can also use custom authentication by providing reference to your `trino.auth.Authentication` class | ||
or factory function (which returns an `Authentication` instance) to `auth_method`. | ||
|
||
All fields in `auth_params` are passed directly to your class/function. | ||
|
||
**Reference**: | ||
* [Trino-Superset-Podcast](https://trino.io/episodes/12.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters