You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
python: How adbc_driver_manager.AdbcConnection gets outgoing call headers #1079
I use Python adbc_driver_flightsql to connect to Flight SQL Server implemented in Java, my Arrow Flight SQL Server implements Auth2 CallHeaderAuthenticator, and the AuthResult returned by authenticate contains the Bearer Token.
It looks like the Bearer Token is in the outgoing call headers and I want to get the Bearer Token from Python adbc_driver_manager.AdbcConnection and use it afterwards, like this:
All I need is send the bearer token back to the server in future requests, is this supported on ADBC 0.6?
When I tested on python ADBC 0.6 the bearer token did not return to the server
cool! , indeed send the bearer token back to the server.
I observed: When creating adbc_driver_manager.AdbcConnection, the bearer token returned by authentication will only be used once (used in the first RPC getFlightInfoSqlInfo).
After that, the first statement request will generate a new bearer token again, and subsequent statement requests will send the bearer token back to the server.
Hmm, that's definitely odd that it's triggering that many authentications, generally that would mean it's creating multiple connections (we do the auth whenever we start a connection), which might make sense if it was sending back multiple FlightEndpoints (since we attempt to download them in parallel) but I'm pretty sure that dremio doesn't do that (unless they've changed it). So i'll take a look and see if i can figure out why it's initializing so many handshakes and connections and get back to you
Activity
lidavidm commentedon Sep 19, 2023
Hmm, what are you trying to accomplish? We already send the bearer token back to the server in future requests - you don't need to explicitly set it.
xinyiZzz commentedon Sep 19, 2023
All I need is
send the bearer token back to the server in future requests, is this supported on ADBC 0.6?When I tested on python ADBC 0.6 the bearer token did not return to the server
xinyiZzz commentedon Sep 19, 2023
AuthResultis returned like this:lidavidm commentedon Sep 19, 2023
It is supported (we integration test against Dremio which does this)
If you try a nightly build (https://gemfury.com/arrow-adbc-nightlies) you can set
ADBC_DRIVER_FLIGHTSQL_LOG_LEVEL=debugto confirm what headers are being sent, do you see it there?xinyiZzz commentedon Sep 19, 2023
In fact I'm referring to Dremio's
BearerTokenAuthenticator.thanks! , I will try a nightly build
xinyiZzz commentedon Sep 19, 2023
cool! , indeed send the bearer token back to the server.
I observed:When creatingadbc_driver_manager.AdbcConnection, the bearer token returned by authentication will only be used once (used in the first RPCgetFlightInfoSqlInfo).After that, the first statement request will generate a new bearer token again, and subsequent statement requests will send the bearer token back to the server.Is this expected? This has misled me before.lidavidm commentedon Sep 19, 2023
Sorry, can you elaborate? Does any request get sent without a bearer token?
xinyiZzz commentedon Sep 19, 2023
Sorry, the above description is not accurate, correction:
adbc_driver_manager.AdbcConnectionwill trigger authenticate 4 times, two of the handshakes will useBASIC_PREFIX, Why do we need two handshakes?stmt.execute_query()will trigger the fifth authenticate, correct use of bearer tokens:lidavidm commentedon Sep 19, 2023
CC @zeroshade
zeroshade commentedon Sep 20, 2023
Hmm, that's definitely odd that it's triggering that many authentications, generally that would mean it's creating multiple connections (we do the auth whenever we start a connection), which might make sense if it was sending back multiple FlightEndpoints (since we attempt to download them in parallel) but I'm pretty sure that dremio doesn't do that (unless they've changed it). So i'll take a look and see if i can figure out why it's initializing so many handshakes and connections and get back to you
lidavidm commentedon Sep 20, 2023
I've kicked off the release already, but it would be good to log connection events as well (I'll file a ticket) to make this clearer
lidavidm commentedon Sep 20, 2023
#1087
xinyiZzz commentedon Sep 21, 2023
Thanks, I will add more information later.
xinyiZzz commentedon Oct 27, 2023
Solved, impl auth2 in Arrow 13.0.0
Close this issue.