Skip to main content
# twiddlepy

`twiddlepy` is a Python library designed for end-to-end extract, transform and load pipline (or ETL for short). Using a mapper file,
and optional functions your data can be transformed into a better suited format.

## Features

- Extract, Transform and Load pipelines
- Multiple datasource options for extracting data
- Multiple repository options for loading data
- Support for mapping input data

## Installation

Twiddlepy is available on the PyPi repository

`pip install twiddlepy`

Or if you want to install directly from the repository: `python setup.py install`, or drop the twiddlepy directory anywhere on your PYTHONPATH.

## Connectors

There are a number of data repository connectors available with Twiddlepy. Currently implemented connectors include:

### Data Source (Input)

- File Based
- CSV
- Excel Document
- Support for custom file loading (e.g. HTML)
- Database
- MySQL
- MSSQL
- Oracle
- SQLite
- MongoDB

### Repository (Output)

- File Based
- CSV
- Apache Solr

## Usage

Create a runnable python file with the following code:

```python
from twiddlepy.config import config
from twiddlepy.driver import TwiddleDriver

driver = TwiddleDriver(config)
driver.process_data()
```

### Example Project Structure

```
.
|-- mapper
| |-- mapper.csv
|-- local_functions.py
|-- run.py (File that runs Twiddle)
|-- twiddle.cfg
```

### User Configuration

Importing config from `twiddle.config` will import the default configuration items for each of the processes,
and will also look for a user defined configuration file on the path where the application is being run from.

All of the configuration items, including all of the default options can be found [here](twiddlepy/data/twiddle_defaults.cfg)

### Mapper File

A mapper file defined by the user is used to defined the input data that will be extracted from
the data repository. The mapper file is a CSV in which there are multiple columns that can be filled in
to specify the data mappings. Thw following columns must be defined in the mapper:

| Column Name | Description | Options |
| :-------------------: | :-----------------------------------------------------------------: | :----------------------------------------------------: |
| dataset | The dataset twiddlepy will use mappings for | Any name (string) |
| source_field_name | A name of a source field | Any name (string) |
| source_field_type | The data type of the source field | One of: "str", "int", "float", "double", "timestamp" |
| allow_missing | Allow the column to be missing in the dataset | One of: "y", "n" (Yes or No) |
| min | Data Validation: minimum allowed value | Any numeric value |
| max | Data Validation: maximum allowed value | Any numeric value |
| allowed_values | Data Validation: list of allowed values | Any array of values |
| unit | The unit the column is represented by | Any name (string) e.g. kg |
| repository | The repository name the column belongs to | Any name (string) |
| repository_field_name | The name the column will be renamed to for data loading | Any name (string) |
| repository_field_type | The data type that will be applied to the column when loading | One of: "string", "integer", "float", "double", "date" |
| ignore | Mark column to be ignore by mapping process (for historic datasets) | One of: "y", "n" (Yes or No) |

## Contribute

As a company, we welcome any input to fix/improve the project. Whilst we don't have a style guide currently,
this is something we will be working on in the future to improve the project further. We're very interested to hear
what you think about Twiddlepy, and any improvements you would like to see so please raise any issues in the tracker!

## Contact

Got a problem/query and want to discuss it with us personally? Contact us at <info@mediaintegration.co.uk>. We also have a website with more
information about the company [here](http://www.mediaintegration.co.uk)


Metadata

Release files for twiddlepy 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for twiddlepy 0.1.3
File Size Uploaded
twiddlepy-0.1.3.tar.gz 34.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for twiddlepy 0.1.3
File Interpreter ABI Platform
twiddlepy-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 88.4 kB

Release files / twiddlepy-0.1.3.tar.gz

Download URL twiddlepy-0.1.3.tar.gz
Size 34.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5b121b7e3dd3bda0734fb2ba1b50e38a9becbee19d1d91dcec98b53298a4c0ed
BLAKE2b-256 checksum
How to use checksums
e878fb2e991491418f403ba23f8b64311810b6debb297abab095f4741a54009f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / twiddlepy-0.1.3-py3-none-any.whl

Download URL twiddlepy-0.1.3-py3-none-any.whl
Size 54.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0325c9e6191ddd33e2cbde53b62da48e807c6c579c97e002cecef130ba9c2e72
BLAKE2b-256 checksum
How to use checksums
70f612bce06e7b86709783bbd207e87cfe3f7df6ca403d6068136aba6e33fd24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page