This example uses Sail, a fast query engine that supports Arrow Flight SQL.
Tip
If you already have a Sail Flight SQL server running, skip the steps to set up Sail.
-
Install Sail:
uv tool install pysail
-
Start the Sail Flight SQL server:
sail flight server --ip 127.0.0.1 --port 32010
Alternatively, you can start the server programmatically using the Sail Python API. Install
pysailinto your environment:uv pip install pysail
Then start the server:
from pysail.flight import FlightSqlServer server = FlightSqlServer(ip="127.0.0.1", port=32010) server.start(background=False)
-
Install the Flight SQL ADBC driver:
dbc install flightsql
-
Customize the Python script
main.pyas needed- Change the connection arguments in
db_kwargsuriis the URI of your Sail Flight SQL server. The host and port will depend on your installation (the default port is 32010). The protocol scheme should begrpcfor plain connections orgrpc+tlsif your server is configured with TLS.
- Change the SQL SELECT statement in
cursor.execute()if desired
- Change the connection arguments in
-
Run the Python script:
uv run main.py
The output will look something like this:
pyarrow.Table result: int64 ---- result: [[2]]
Stop the Sail Flight SQL server by pressing Ctrl-C in the terminal where it is running.