You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "xinyiZzz (via GitHub)" <gi...@apache.org> on 2023/09/19 14:38:54 UTC
[GitHub] [arrow-adbc] xinyiZzz opened a new issue, #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
xinyiZzz opened a new issue, #1079:
URL: https://github.com/apache/arrow-adbc/issues/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.
```
db = adbc_driver_flightsql.connect(uri="grpc://xxx:xx", db_kwargs={
adbc_driver_manager.DatabaseOptions.USERNAME.value: "root",
adbc_driver_manager.DatabaseOptions.PASSWORD.value: "",
})
conn = adbc_driver_manager.AdbcConnection(db)
```
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:
```
db = adbc_driver_flightsql.connect(uri="grpc://xxx:xxx", db_kwargs={
adbc_driver_flightsql.DatabaseOptions.AUTHORIZATION_HEADER.value: "Bearer <token>",
})
conn = adbc_driver_manager.AdbcConnection(db)
```
I need help, thanks~
--
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: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] zeroshade commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1727923449
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
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1727929960
https://github.com/apache/arrow-adbc/issues/1087
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] xinyiZzz commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1725891125
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.
Is this expected? This has misled me before.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1725795369
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=debug` to confirm what headers are being sent, do you see it there?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers [arrow-adbc]
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1782243600
Solved, impl auth2 in Arrow 13.0.
Close this issue.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] xinyiZzz commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1725804159
In fact I'm referring to Dremio's `BearerTokenAuthenticator`.
thanks! , I will try a nightly build
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1726040908
CC @zeroshade
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] xinyiZzz commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1725793959
`AuthResult` is returned like this:
```
private AuthResult createAuthResultWithBearerToken(String token) {
return new AuthResult() {
@Override
public void appendToOutgoingHeaders(CallHeaders outgoingHeaders) {
outgoingHeaders.insert(Auth2Constants.AUTHORIZATION_HEADER,
Auth2Constants.BEARER_PREFIX + token);
}
@Override
public String getPeerIdentity() {
return token;
}
};
}
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1727929122
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
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1725781232
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.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] xinyiZzz commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1726038438
Sorry, the above description is not accurate, correction:
`adbc_driver_manager.AdbcConnection` will trigger authenticate 4 times, two of the handshakes will use `BASIC_PREFIX`, Why do we need two handshakes?
1.
methodName: `arrow.flight.protocol.FlightService/Handshake`
incomingHeaders: `authorization=Basic cm9vdDo`
2.
methodName: `arrow.flight.protocol.FlightService/GetFlightInfo`
incomingHeaders: `authorization=Bearer test_token)`
3.
methodName: `arrow.flight.protocol.FlightService/Handshake`
incomingHeaders: `authorization=Basic cm9vdDo`
4.
methodName: `arrow.flight.protocol.FlightService/DoGet`
incomingHeaders: `authorization=Bearer test_token)`
`stmt.execute_query()` will trigger the fifth authenticate, correct use of bearer tokens:
5.
methodName: `arrow.flight.protocol.FlightService/GetFlightInfo`
incomingHeaders: `authorization=Bearer test_token)`
```
import pyarrow
import adbc_driver_flightsql.dbapi as flight_sql
import adbc_driver_flightsql
import adbc_driver_manager
db = adbc_driver_flightsql.connect(uri="grpc://10.16.10.8:10478", db_kwargs={
adbc_driver_manager.DatabaseOptions.USERNAME.value: "root",
adbc_driver_manager.DatabaseOptions.PASSWORD.value: "",
})
conn = adbc_driver_manager.AdbcConnection(db)
stmt = adbc_driver_manager.AdbcStatement(conn)
stmt.set_sql_query("select * from tpch.hdf5 limit 1000000;")
stream, rows = stmt.execute_query()
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1725900520
Sorry, can you elaborate? Does any request get sent without a bearer token?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers [arrow-adbc]
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz closed issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
URL: https://github.com/apache/arrow-adbc/issues/1079
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] xinyiZzz commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1729359847
Thanks, I will add more information later.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] xinyiZzz commented on issue #1079: python: How `adbc_driver_manager.AdbcConnection` gets outgoing call headers
Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #1079:
URL: https://github.com/apache/arrow-adbc/issues/1079#issuecomment-1725790105
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
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org