baiguoname opened a new issue, #8077:
URL: https://github.com/apache/arrow-rs/issues/8077
```rust
async fn test_flight_async2() -> Result<()> {
let url = format!("grpc://{host}:{port}");
let channel = Channel::from_shared(url)
.unwrap()
.http2_keep_alive_interval(std::time::Duration::from_secs(60))
.keep_alive_timeout(std::time::Duration::from_secs(10))
.connect()
.await
.unwrap();
let mut client = FlightSqlServiceClient::new(channel);
client.handshake(username, password).await.unwrap();
let flight_info = client.execute(
query.to_string(),
None,
)
.await
.unwrap();
for endpoint in flight_info.endpoint {
if let Some(ticket) = endpoint.ticket {
let mut req = Request::new(Ticket { ticket: ticket.ticket });
let mut stream = client
.do_get(req)
.await
.unwrap()
.into_inner();
while let Some(flight_data) = stream
.try_next()
.await
.unwrap()
{
println!("aaa");
}
}
}
Ok(())
}
```
But if I write python like this, everything is fine:
```python
import adbc_driver_manager
import adbc_driver_flightsql.dbapi as flight_sql
import pandas as pd
import time
FE_HOST = "192.168.1.86"
FE_PORT = 9408
conn = flight_sql.connect(
uri=f"grpc://{FE_HOST}:{FE_PORT}",
db_kwargs={
adbc_driver_manager.DatabaseOptions.USERNAME.value: "test",
adbc_driver_manager.DatabaseOptions.PASSWORD.value: "Aa123456",
}
)
cursor = conn.cursor()
def print_header(title: str):
"""
Print a section header for better readability.
"""
print("\n" + "=" * 80)
print(f"🟢 {title}")
print("=" * 80)
# Print the SQL statement being executed
def print_sql(sql: str):
"""
Print the SQL statement before execution.
"""
print(f"\n🟡 SQL:\n{sql.strip()}")
# Print the result DataFrame
def print_result(df: pd.DataFrame):
"""
Print the result DataFrame in a readable format.
"""
if df.empty:
print("\n🟢 Result: (no rows returned)\n")
else:
print("\n🟢 Result:\n")
print(df.to_string(index=False))
# Print the error traceback
def print_error(e: Exception):
"""
Print the error traceback if SQL execution fails.
"""
print("\n🔴 Error occurred:")
# Execute a SQL statement and print the result
def execute(sql: str):
"""
Execute a SQL statement and print the result and execution time.
"""
print_sql(sql)
try:
start = time.time() # Optional: start time for execution time
measurement
cursor.execute(sql)
result = cursor.fetchallarrow() # Arrow Table
print(f"\n⏱️ Execution time: {time.time() - start:.3f} seconds")
# df = result.to_pandas() # Optional: convert to DataFrame for
better display
return result
except Exception as e:
print_error(e)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]