Connect to trino with special symbol

Hello

I’m trying connect to trino, but my password have special symbols(quote and quote_plus not working in string conectation in SQLAlchemy (trino)

context = gx.get_context(mode="file")
conn_str =  f"trino://{user}@{host}:{port}/{catalog}?verify=false&http_scheme=https"


connect_args = {
    "http_scheme": "https",  
    "verify": False,  
    "auth": BasicAuthentication(user, password) 
}

datasource = context.data_sources.add_sql(
    name="trino_datasource_kwargs",
    connection_string=conn_str,
    kwargs =  {"connect_args": connect_args}
)


  File "C:\Users\Anastasiya.Vatutina\git_projects\my_new_env\Lib\site-packages\pydantic\v1\json.py", line 90, in pydantic_encoder
    raise TypeError(f"Object of type '{obj.__class__.__name__}' is not JSON serializable")
TypeError: Object of type 'BasicAuthentication' is not JSON serializable


But, if i using ephemeral = it’s work

context = gx.get_context(mode="ephemeral")

config = datasource.dict()

print(yaml.dump(config, default_flow_style=False, indent=2))  
connection_string: trino://user@connect-dev.xx.ru:443/catalog_ice?verify=false&http_scheme=https
id: !!python/object:uuid.UUID
  int: 70498352837603432451497043048075957864
kwargs:
  connect_args:
    auth: !!python/object:trino.auth.BasicAuthentication
      _password: my_pass$@#
      _username: user
    http_scheme: https
    verify: false
name: trino_datasource_kwargs
type: sql

also i’m trying writing in great_expectations.yaml this connect, but mapping not work((
I’m usimg GX Core 1.5.8
in GX Core 0.18 not problem

1 Like