Skip to content

Commit

Permalink
fix(trino): inject access token into trino's connect args
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoferrao committed Aug 31, 2024
1 parent 528ce78 commit 0fadd94
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions superset/db_engine_specs/trino.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import numpy as np
import pandas as pd
import pyarrow as pa
import requests
from flask import copy_current_request_context, ctx, current_app, Flask, g
from sqlalchemy import text
from sqlalchemy.engine.reflection import Inspector
Expand Down Expand Up @@ -156,6 +157,10 @@ def update_impersonation_config(
# Set principal_username=$effective_username
if backend_name == "trino" and username is not None:
connect_args["user"] = username
if connect_args.get("auth", "").lower() not in ["ldap", "kerberos"]:
http_session = requests.Session()
http_session.headers.update({"Authorization": f"Bearer {access_token}"})
connect_args["http_session"] = http_session

@classmethod
def get_url_for_impersonation(
Expand Down

0 comments on commit 0fadd94

Please sign in to comment.