-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
Here is the code snippet that I am using
// Add relevant properties to connect to SEP, refer the README to know more about the properties.
TrinoConnectionProperties SEPProperties = new TrinoConnectionProperties()
{
AllowHostNameCNMismatch = true,
AllowSelfSignedServerCert = true,
Auth = new BasicAuth
{
User="admin",
Password="admin"
},
Catalog = "tpcds",
Host = "<host>",
Roles = new Dictionary<string, ClientSelectedRole>()
{{
"system",
new ClientSelectedRole (ClientSelectedRole.Type.ROLE,"sysadmin")
}},
Port = 443,
EnableSsl = true,
Source = "SEPonADONET",
User = "admin"
};
// Open a connection to the Trino Server
TrinoConnection sep = new TrinoConnection(SEPProperties);
IDbCommand trinoQuery = new TrinoCommand(sep, "select c_customer_sk,c_birth_country from tpcds.tiny.customer");
IDataReader sepResults = trinoQuery.ExecuteReader();
Here is the result from the application run
Error while trying Trino ADO ClientTrino.Client.TrinoException: Error 400 Bad Request: Invalid X-Trino-Role header ---> Trino.Client.TrinoException: HTTP 400 (BadRequest): Error 400 Bad Request: Invalid X-Trino-Role header
at Trino.Client.AbstractClient`1.<GetResourceAsync>d__20.MoveNext()
--- End of inner exception stack trace ---
at Trino.Client.StatementClientV1.<GetInitialResponse>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Trino.Client.RecordExecutor.<Execute>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Trino.Data.ADO.Server.TrinoCommand.<RunQuery>d__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Trino.Data.ADO.Server.TrinoCommand.<ExecuteDbDataReaderAsync>d__43.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Trino.Data.ADO.Utilities.TaskUtilities.SafeResult[T](Task`1 a)
at Trino.Data.ADO.Server.TrinoCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at SEPonADODOTNET.Program.Main(String[] args) in <>SEPonADODOTNET\Program.cs:line 74
I tried to locate the code which translates the C# object definition to respective HTTP Header, I was not skilled enough i suppose to find it, I believe the issue might due to the fact the Trino Header is malformed and not in the X-Trino-Header: catalog=ROLE{role} format, as i was able to override this in my code to connect to the Trino with the sysadmin role. Is there a minimum version of Trino needed to use C#Client?
Feel free to reach back, i am sure it would something silly i am doing/missing
Metadata
Metadata
Assignees
Labels
No labels