Skip to content

Commit

Permalink
fix(Trino): create PrestoBaseEngineSpec base class to share common …
Browse files Browse the repository at this point in the history
…code between Trino and Presto (#21066)

* chore: create `PrestoBaseEngineSpec` class that share common functions between Presto and Trino

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

* feat(Trino): support CertificateAuthentication

* chore(Presto): move `get_function_names` to `PrestoBaseEngineSpec`

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

* chores(Presto): remove `is_readonly_query`

* feat(Trino): implement `extra_table_metadata`

* feat(Trino): specify `User-Agent`

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

* fix: pylint

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

* chores(Presto): move `PrestoBaseEngineSpec` to `presto.py`

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

* fix(Presto): typing annotations

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>
  • Loading branch information
dungdm93 committed Aug 29, 2022
1 parent 5f76ac9 commit ccb293a
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 205 deletions.
18 changes: 16 additions & 2 deletions docs/docs/databases/trino.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,21 @@ In `Secure Extra` field, config as following example:

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
#### 3. Certificate Authentication
In `Secure Extra` field, config as following example:
```json
{
"auth_method": "certificate",
"auth_params": {
"cert": "/path/to/cert.pem",
"key": "/path/to/key.pem"
}
}
```

All fields in `auth_params` are passed directly to the [`CertificateAuthentication`](https://github.com/trinodb/trino-python-client/blob/0.315.0/trino/auth.py#L416) class.

#### 4. JWT Authentication
Config `auth_method` and provide token in `Secure Extra` field
```json
{
Expand All @@ -67,7 +81,7 @@ Config `auth_method` and provide token in `Secure Extra` field
}
```

#### 4. Custom Authentication
#### 5. Custom Authentication
To use custom authentication, first you need to add it into
`ALLOWED_EXTRA_AUTHENTICATIONS` allow list in Superset config file:
```python
Expand Down
5 changes: 0 additions & 5 deletions superset/db_engine_specs/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
# prevent circular imports
from superset.models.core import Database


logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -262,10 +261,6 @@ def convert_dttm(
.isoformat(sep=" ", timespec="microseconds")}' AS TIMESTAMP)"""
return None

@classmethod
def epoch_to_dttm(cls) -> str:
return "from_unixtime({col})"

@classmethod
def adjust_database_uri(
cls, uri: URL, selected_schema: Optional[str] = None
Expand Down
Loading

0 comments on commit ccb293a

Please sign in to comment.