Python SDK

The Airplane Python SDK provides utilities to interact with the Airplane platform.

Installation

The Airplane Python SDK is available as a PyPI package, airplanesdk. To install it, run:
bash
Copied
1
$ pip install airplanesdk
There's another PyPI package called airplane (without the sdk prefix) that is completely unrelated to Airplane.dev.

Basic usage

Here is a simple example of how the SDK can be used to:
  1. Select users from a database filtered by name
  2. Display the selected users in a table
  3. Return the number of users that matched
python
Copied
1
import airplane
2
3
@airplane.task(
4
resources=[airplane.Resource("demo_db")],
5
)
6
def lookup_users(name: str):
7
print(f"Looking up users like '{name}'")
8
run = airplane.sql.query(
9
"demo_db",
10
"""
11
select id, name, email from users
12
where (name ilike :name or email ilike :name)
13
order by name asc
14
""",
15
query_args={"name": name}
16
)
17
users = run.output["Q1"]
18
airplane.display.table(users)
19
return {
20
"num_users": len(users),
21
}

Concepts

The SDK reference is broken out into pages for each concept. For details and examples, see the pages below.