Skip to main content

A simple data ingestion library to guide data flows from some places to other places

Project description

Viadot

build status formatting codecov

Documentation: https://dyvenia.github.io/viadot/

Source Code: https://github.com/dyvenia/viadot


A simple data ingestion library to guide data flows from some places to other places.

Getting Data from a Source

Viadot supports several API and RDBMS sources, private and public. Currently, we support the UK Carbon Intensity public API and base the examples on it.

from viadot.sources.uk_carbon_intensity import UKCarbonIntensity
ukci = UKCarbonIntensity()
ukci.query("/intensity")
df = ukci.to_df()
df

Output:

from to forecast actual index
0 2021-08-10T11:00Z 2021-08-10T11:30Z 211 216 moderate

The above df is a python pandas DataFrame object. The above df contains data downloaded from viadot from the Carbon Intensity UK API.

Loading Data to a Source

Depending on the source, viadot provides different methods of uploading data. For instance, for SQL sources, this would be bulk inserts. For data lake sources, it would be a file upload. We also provide ready-made pipelines including data validation steps using Great Expectations.

An example of loading data into SQLite from a pandas DataFrame using the SQLiteInsert Prefect task:

from viadot.tasks import SQLiteInsert

insert_task = SQLiteInsert()
insert_task.run(table_name=TABLE_NAME, dtypes=dtypes, db_path=database_path, df=df, if_exists="replace")

Running tests

To run tests, log into the container and run pytest:

cd viadot/docker
run.sh
docker exec -it viadot_testing bash
pytest

Running flows locally

You can run the example flows from the terminal:

run.sh
docker exec -it viadot_testing bash
FLOW_NAME=hello_world; python -m viadot.examples.$FLOW_NAME

However, when developing, the easiest way is to use the provided Jupyter Lab container available at http://localhost:9000/.

How to contribute

  1. Clone the release branch
  2. Pull the docker env by running viadot/docker/update.sh -t dev
  3. Run the env with viadot/docker/run.sh
  4. Log into the dev container and install in development mode so that viadot will auto-install at each code change:
docker exec -it viadot_testing bash
pip install -e .
  1. Edit and test your changes with pytest
  2. Submit a PR. The PR should contain the following:
  • new/changed functionality
  • tests for the changes
  • changes added to CHANGELOG.md
  • any other relevant resources updated (esp. viadot/docs)

Please follow the standards and best practices used within the library (eg. when adding tasks, see how other tasks are constructed, etc.). For any questions, please reach out to us here on GitHub.

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

viadot-0.2.3.tar.gz (43.1 kB view details)

Uploaded Source

Built Distribution

viadot-0.2.3-py3-none-any.whl (67.1 kB view details)

Uploaded Python 3

File details

Details for the file viadot-0.2.3.tar.gz.

File metadata

  • Download URL: viadot-0.2.3.tar.gz
  • Upload date:
  • Size: 43.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.11

File hashes

Hashes for viadot-0.2.3.tar.gz
Algorithm Hash digest
SHA256 0578d7d0489d39cd324d30cf04dbf77358cfae64b5959ee59175a56ae8324db3
MD5 528a6c8e12c446b05819e5e3db6c685c
BLAKE2b-256 c5f964995680ca89cda00f7f0353c1284fd4f2762a23e502a7fd66d0db6d1765

See more details on using hashes here.

File details

Details for the file viadot-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: viadot-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 67.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.11

File hashes

Hashes for viadot-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8b97675ae1aaf8af78caa0db3a13b81a853c1260a7d6e4b48bc1689fa37892d5
MD5 1e521d4ee351899d27578aa91fbfa150
BLAKE2b-256 3f31378ac45ff9467b70ddce43e46ef6d4985e51025fb463e14781eaa1883d68

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page