Closed groobyming closed 4 months ago
Please provide trino server version and the full example code.
Please provide trino server version and the full example code.
@nooberfsh Thanks for your replay.
Trino version: 382
Example Code:
use prusto::{ClientBuilder, Presto};
#[derive(Presto, Debug)]
struct Foo {
a: i64,
b: f64,
c: String,
}
#[tokio::test]
async fn main() {
let cli = ClientBuilder::new("user", "localhost")
.port(8080)
.catalog("iceberg")
.build()
.unwrap();
let sql = "SELECT * FROM iceberg.iceberg_test.test_log LIMIT 1";
let result = cli.get_all::<Foo>(sql.to_string()).await.unwrap().into_vec();
}
I can see the server is running locally, can you confirm the server can be accessed through trino-cli or other database tools, such as DataGrip or dbeaver.
I can see the server is running locally, can you confirm the server can be accessed through trino-cli or other database tools, such as DataGrip or dbeaver.
Connect success when using the idea database tool:
It seems there is some error message in the background.
Can you run some simple query to see whether it is actually working?
@nooberfsh I believe the issue is caused by different request headers in the Presto and Trino clients.
【Presto headers】: https://prestodb.io/docs/current/develop/client-protocol.html
【Trino headers】: https://trino.io/docs/current/develop/client-protocol.html
And In our project, we can only hardcode the Presto header. https://github.com/nooberfsh/prusto/blob/master/src/presto_header.rs
Is there any way to customize this header?
prusto
has two set of headers which is defined in header.rs and presto_header.rs, the default headers is trino, the presto header can be enabled by the presto
feature.
As I said before, can you run some simple query in the IDE to see whether it is actually working?
It seems there is some error message in the background. Can you run some simple query to see whether it is actually working?
when I disable presto feature, it works for me
prusto
has two set of headers which is defined in header.rs and presto_header.rs, the default headers is trino, the presto header can be enabled by thepresto
feature.As I said before, can you run some simple query in the IDE to see whether it is actually working?
When I follow the official documentation example to connect to an existing trino server, I get the following error
HttpNotOk(401, "Basic authentication or X-Trino-User must be sent")
Here is my code: