This release is a pre-release and may not be stable for production use.
Datasaurus is a Data Engineering framework written in Python 3.8, 3.9, 3.10 and 3.11
It is based in Polars and heavily influenced by Django.
Datasaurus offers an opinionated, feature-rich and powerful framework to help you write data pipelines, ETLs or data manipulation programs.
Documentation (TODO)
It supports:
- ✅ Fully support read/write operations.
- ⭕ Not yet but will be implemented.
- 💀 Won't be implemented in the near future.
Storages:
- Sqlite ✅
- PostgresSQL ✅
- MySQL ✅
- Mariadb ✅
- Local Storage ✅
- Azure blob storage ⭕
- AWS S3 ⭕
Formats:
- CSV ✅
- JSON ✅
- PARQUET ✅
- EXCEL ✅
- AVRO ✅
- TSV ⭕
- SQL ⭕ (Like sql inserts)
Features:
- Delta Tables ⭕
- Field validations ⭕
Simple example
# settings.py
from datasaurus.core.storage import PostgresStorage, StorageGroup, SqliteStorage
from datasaurus.core.models import StringColumn, IntegerColumn
# We set the environment that will be used.
os.environ['DATASAURUS_ENVIRONMENT'] = 'dev'
class ProfilesData(StorageGroup):
dev = SqliteStorage(path='/data/data.sqlite')
live = PostgresStorage(username='user', password='user', host='localhost', database='postgres')
# models.py
from datasaurus.core.models import Model, StringColumn, IntegerColumn
class ProfileModel(Model):
id = IntegerColumn()
username = StringColumn()
mail = StringColumn()
sex = StringColumn()
class Meta:
storage = ProfilesData
table_name = 'PROFILE'
We can access the raw Polars dataframe with 'Model.df', it's lazy, meaning it will only load the data if we access the attribute.
>>> ProfileModel.df
shape: (100, 4)
┌─────┬────────────────────┬──────────────────────────┬─────┐
│ id ┆ username ┆ mail ┆ sex │
│ --- ┆ --- ┆ --- ┆ --- │
│ i64 ┆ str ┆ str ┆ str │
╞═════╪════════════════════╪══════════════════════════╪═════╡
│ 1 ┆ ehayes ┆ colleen63@hotmail.com ┆ F │
│ 2 ┆ thompsondeborah ┆ judyortega@hotmail.com ┆ F │
│ 3 ┆ orivera ┆ iperkins@hotmail.com ┆ F │
│ 4 ┆ ychase ┆ sophia92@hotmail.com ┆ F │
│ … ┆ … ┆ … ┆ … │
│ 97 ┆ mary38 ┆ sylvia80@yahoo.com ┆ F │
│ 98 ┆ charlessteven ┆ usmith@gmail.com ┆ F │
│ 99 ┆ plee ┆ powens@hotmail.com ┆ F │
│ 100 ┆ elliottchristopher ┆ wilsonbenjamin@yahoo.com ┆ M │
└─────┴────────────────────┴──────────────────────────┴─────┘
We could now create a new model whose data is created from ProfileModel
class FemaleProfiles(Model):
id = IntegerField()
profile_id = IntegerField()
mail = StringField()
def calculate_data(self):
return (
ProfileModel.df
.filter(ProfileModel.sex == 'F')
.with_row_count('new_id')
.with_columns(
pl.col('new_id')
)
.with_columns(
pl.col('id').alias('profile_id')
)
)
class Meta:
recalculate = 'if_no_data_in_storage'
storage = ProfilesData
table_name = 'PROFILE_FEMALES'
Et voilá! the columns will be auto selected from the column definitions (id, profile_id and email).
If we now call:
FemaleProfiles.df
It will check if the dataframe exists in the storage and if it does not, it will 'calculate' it again from calculate_data and save it to the Storage, this parameter can also be set to 'always'.
You can also move data to different environments or storages, making it easy to change formats or move data around:
FemaleProfiles.save(to=ProfilesData.live)
Effectively moving data from SQLITE (dev) to PostgreSQL (live),
# Can also change formats
FemaleProfiles.save(to=ProfilesData.otherenvironment, format=LocalFormat.JSON)
FemaleProfiles.save(to=ProfilesData.otherenvironment, format=LocalFormat.CSV)
FemaleProfiles.save(to=ProfilesData.otherenvironment, format=LocalFormat.PARQUET)
Metadata
Release files for datasaurus 0.0.2.dev4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datasaurus-0.0.2.dev4.tar.gz | 16.9 kB | Without provenance | Details for datasaurus-0.0.2.dev4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datasaurus-0.0.2.dev4-py3-none-any.whl | Python 3 | none | any | Details for datasaurus-0.0.2.dev4-py3-none-any.whl |
Total release size: 36.9 kB
Release files / datasaurus-0.0.2.dev4.tar.gz
| Download URL | datasaurus-0.0.2.dev4.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8dd2a76fb6d52049232782ec575d2d53f634095478781a4a13c3793ec8a322a
|
|
BLAKE2b-256 checksum How to use checksums |
34e537f1adf2e208b1a93e60d29c2b22ba4b4eb121850c8c0dab77319f7c9d46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.6 Linux/6.6.7-arch1-1
|
Release files / datasaurus-0.0.2.dev4-py3-none-any.whl
| Download URL | datasaurus-0.0.2.dev4-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e37584a072adf1184b546fe4f0a66dd13dd55ccaed6ef89102fdd609f780ce7
|
|
BLAKE2b-256 checksum How to use checksums |
a9cf9a68b4764c1a2df2668e8d8141c614654d45a3d55d8ee8f9ceeca03e74f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.6 Linux/6.6.7-arch1-1
|
Security for datasaurus 0.0.2.dev4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.