Klondike is a suite of database connectors, powered by Polars
Project description
Klondike
Klondike offers a lightweight, unified API to read and write data to and from various database and data warehouse types using Polars DataFrames.
Installation
Installing Klondike
Install at the command line
pip install klondike
Installing Rust
Since Polars leverages Rust speedups, you need to have Rust installed in your environment as well. See the Rust installation guide here.
Usage
In this demo we'll connect to Google BigQuery, read data, transform it, and write it back to the data warehouse.
First, connect to the BigQuery warehouse by supplying the BigQueryConnector() object with the relative path to your service account credentials.
from klondike import BigQueryConnector
# Connect Klondike to Google BigQuery
bq = BigQueryConnector(
app_creds="dev/nba-player-service.json"
)
Next, supply the object with a SQL query in the read_dataframe() function to redner a DataFrame object:
# Write some valid SQL
sql = """
SELECT
*
FROM nba_dbt.cln_player__averages
ORDER BY avg_points DESC
"""
# Pull BigQuery data into a Polars DataFrame
nyk = bq.read_dataframe(sql=sql)
Now that your data is pulled into a local instance, you can clean and transform it using standard Polars functionality - see the docs for more information.
# Perform some transformations
key_metrics = [
"avg_offensive_rating",
"avg_defensive_rating",
"avg_effective_field_goal_percentage"
]
summary_stats = nyk[key_metrics].describe()
Finally, push your transformed data back to the BigQuery warehouse using the write_dataframe() function:
# Write back to BigQuery
bq.write_dataframe(
df=summary_stats,
table_name="nba_dbt.summary_statistics",
if_exists="truncate"
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file klondike-0.3.0.tar.gz.
File metadata
- Download URL: klondike-0.3.0.tar.gz
- Upload date:
- Size: 3.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1270da3eca6851cfe663dd773c8b1e62111982cfa25dd8b4f609a982f8118e6
|
|
| MD5 |
b1d9df9af53e77f2000dae8b743dceda
|
|
| BLAKE2b-256 |
72b6a7f32ce45813c161f9f8477b85518b51299a710e18c5d63760fee4997219
|
Provenance
The following attestation bundles were made for klondike-0.3.0.tar.gz:
Publisher:
publish.yml on IanRFerguson/klondike
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
klondike-0.3.0.tar.gz -
Subject digest:
b1270da3eca6851cfe663dd773c8b1e62111982cfa25dd8b4f609a982f8118e6 - Sigstore transparency entry: 927297708
- Sigstore integration time:
-
Permalink:
IanRFerguson/klondike@9ece643fd9aa82e218428bd2d625d49c86f6e9f0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/IanRFerguson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ece643fd9aa82e218428bd2d625d49c86f6e9f0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file klondike-0.3.0-py3-none-any.whl.
File metadata
- Download URL: klondike-0.3.0-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3ff448cfaa702f9ff794071b6af29031aa26acc3dda17bec45cce6527b3d697
|
|
| MD5 |
7d1b2b134dc0fa38d55c872fc0e24d87
|
|
| BLAKE2b-256 |
ec6c451d29adaa4bd103a46aaa09c3b4e54e8f051b5423d4f389858ab629fc92
|
Provenance
The following attestation bundles were made for klondike-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on IanRFerguson/klondike
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
klondike-0.3.0-py3-none-any.whl -
Subject digest:
a3ff448cfaa702f9ff794071b6af29031aa26acc3dda17bec45cce6527b3d697 - Sigstore transparency entry: 927297710
- Sigstore integration time:
-
Permalink:
IanRFerguson/klondike@9ece643fd9aa82e218428bd2d625d49c86f6e9f0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/IanRFerguson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ece643fd9aa82e218428bd2d625d49c86f6e9f0 -
Trigger Event:
push
-
Statement type: