feat: Trino Authentications (#17593)

* feat: support Trino Authentications

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

* docs: Trino Authentications

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>
This commit is contained in:
Đặng Minh Dũng
2022-01-15 12:02:47 +07:00
committed by GitHub
parent 5da3c45fc6
commit 0b67fe1beb
9 changed files with 286 additions and 23 deletions

View File

@@ -1273,6 +1273,26 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
raise ex
return extra
@staticmethod
def update_encrypted_extra_params(
database: "Database", params: Dict[str, Any]
) -> None:
"""
Some databases require some sensitive information which do not conform to
the username:password syntax normally used by SQLAlchemy.
:param database: database instance from which to extract extras
:param params: params to be updated
"""
if not database.encrypted_extra:
return
try:
encrypted_extra = json.loads(database.encrypted_extra)
params.update(encrypted_extra)
except json.JSONDecodeError as ex:
logger.error(ex, exc_info=True)
raise ex
@classmethod
def is_readonly_query(cls, parsed_query: ParsedQuery) -> bool:
"""Pessimistic readonly, 100% sure statement won't mutate anything"""