PyStarburst DataFrame API allows you to query and transform data in Starburst products in a data pipeline without having to download the data locally.
Project description
PyStarburst DataFrame API
PyStarburst DataFrame API allows you to query and transform data in Starburst products in a data pipeline without having to download the data locally.
Documentation
See the PyStarburst API documentation and the examples repository.
Getting started
Install pystarburst
pip install pystarburst
Connect to a Starburst server
The parameters are the same connect parameters as in Trino Python Client.
from pystarburst import Session
connection_parameters = {
"host": "localhost",
"port": 8080,
"user": "admin",
"catalog": "tpch",
"schema": "tiny"
}
session = Session.builder.configs(connection_parameters).create()
Using SQL
from pystarburst import Session
session = Session.builder.configs({ ... }).create()
session.sql("SELECT 1 as a").show()
Querying a table
from pystarburst import Session
session = Session.builder.configs({ ... }).create()
df = session.table("nation")
print(df.schema)
df.show()
Filtering a data frame
from pystarburst import Session
session = Session.builder.configs({ ... }).create()
df = session.table("nation")
df.filter(df.col("regionkey") == 0).show()
Joining data frames
from pystarburst import Session
session = Session.builder.configs({ ... }).create()
df = session.table("nation")
df.filter(df.col("regionkey") == 0).show()
Aggregation
from pystarburst import Session
from pystarburst.functions import col
session = Session.builder.configs({ ... }).create()
df = session.table("nation")
df.agg((col("regionkey"), "max"), (col("regionkey"), "avg")).show()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
pystarburst-0.9.0-py3-none-any.whl
(135.3 kB
view details)
File details
Details for the file pystarburst-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: pystarburst-0.9.0-py3-none-any.whl
- Upload date:
- Size: 135.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 451add705d43056e135091e7d4bdbc04c03da89c4e535365c62ea5e853e88b10 |
|
MD5 | 8259bf26bb867d64e4332edf29f687f6 |
|
BLAKE2b-256 | 34424d61284c1747a2b6ed4db82c4dc96aaaa54887401483fa46775d63eb249e |