Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example showing how to provide "flight call options" when making a connection against a (quackpy) Flight SQL server #28

Open
mskyttner opened this issue Feb 14, 2025 · 2 comments

Comments

@mskyttner
Copy link

Trying to figure out how to use adbi to get a connection to a Flight SQL server and while able to successfully get a connection against Voltron's sqlflite server - reproducable w containers here, I am stuck on authenticating against another containerized server quackpy.

From python the following can be used to establish a connection against the quackpy Flight SQL server:

from pyarrow.flight import FlightClient, Ticket, FlightCallOptions 
sql="""SELECT version()"""  
flight_ticket = Ticket(sql)

token = (b"authorization", bytes(f"user:persistence".encode('utf-8')))
options = FlightCallOptions(headers=[token])
client = FlightClient(f"grpc://localhost:8815")
reader = client.do_get(flight_ticket, options)
arrow_table = reader.read_all()

From R, using adbi, how do I provide the equivalent "FlightCallOptions" when initiating the connection?

Attempting to provide authentication details through the uri (I might be doing this wrong obviously) I get a server response like below:

./fly.R grpc://user:persistence@localhost:8815/ "from lineitem limit 5;"
Registered S3 methods overwritten by 'adbi':
  method                      from
  infer_nanoarrow_schema.AsIs nanoarrow
  infer_nanoarrow_schema.list nanoarrow
Error in force(code) :
  IO: [FlightSQL] write tcp 127.0.0.1:52716->127.0.0.1:8815: write: broken pipe (Unavailable; AuthenticateBasicToken)
Calls: <Anonymous> ... <Anonymous> -> with_adbc -> force -> stop_for_error
Execution halted
@krlmlr
Copy link
Member

krlmlr commented Feb 23, 2025

Thanks. The adbi package is mostly a wrapper around adbcdrivermanager. Can you establish a connection from there?

Copying @paleolimbot.

@paleolimbot
Copy link

I wonder if you are mixing up Flight and FlightSQL here? I think FlightSQL uses a different mechanism...if you need Flight specifically I think the arrow package has an option: https://arrow.apache.org/docs/r/reference/index.html#flight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants