A lightweight Python interface for extracting and loading using the Singer.io spec.
Project description
ELX
🚧 Under construction
A lightweight Python interface for extracting and loading using the Singer.io spec.
⚡ Lazy install of Singer.io taps and targets
⚡ Stream parallelism for high performance
⚡ Remote state management
⚡ Tap catalog is available in Python for metadata purposes
🔗 Native integration with Dagster
🔗 Native integration with Airflow (todo)
🔗 Native integration with Prefect (todo)
Installation
pip install elx --pre
Usage
The most basic usage is as follows. Simply define the Tap and the Target and elx will take care of the rest.
from elx import Runner, Tap, Target
runner = Runner(
Tap("git+https://gitlab.com/meltano/tap-carbon-intensity.git"),
Target("target-jsonl")
)
runner.run()
Configuration
You can configure the tap and target by passing a config
dictionary to the Tap
and Target
constructors. The config will be injected into the tap and target at runtime.
from elx import Tap, Target
tap = Tap(
"tap-foo",
config={
"api_key": "1234567890",
"start_date": "2020-01-01"
}
)
target = Target(
"target-bar",
config={
"file_path": "/tmp"
}
)
State
By default, elx will store the state in the same directory as the script that is running. You can override this by passing a StateManager
to the Runner
constructor. Behind the scenes, elx uses smart-open to be able to store the state in a variety of locations.
from elx import Runner, StateManager
runner = Runner(
tap,
target,
state_manager=StateManager("s3://my-bucket/my-folder")
)
Supported paths include:
Path | Required Environment Variables | Elx Extra |
---|---|---|
s3://my-bucket/my-folder |
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY |
elx[s3] |
gs://my-bucket/my-folder |
GOOGLE_APPLICATION_CREDENTIALS or GOOGLE_API_TOKEN |
elx[gs] |
azure://my-bucket/my-folder |
AZURE_STORAGE_CONNECTION_STRING |
elx[azure] |
~/my-folder |
None |
None |
/tmp/my-folder |
None |
None |
(ssh|scp|sftp)://username@host//my-folder |
None |
None |
(ssh|scp|sftp)://username:password@host//my-folder |
None |
None |
Config injection
There are certain variables that are available to inject in the tap or target config. One common use case is to place the tap data in a schema with the tap name.
target = Target(
"target-bar",
config={
"default_target_schema": "{TAP_NAME}"
}
)
Supported variables:
Variable | Example |
---|---|
NOW |
2023-08-17T11:06:54.233086 |
YESTERDAY |
2023-08-16T11:06:54.233086 |
LAST_WEEK |
2023-08-10T11:06:54.233086 |
TAP_EXECUTABLE |
tap-smoke-test |
TAP_NAME |
tap_smoke_test |
TARGET_EXECUTABLE |
target-postgres |
TARGET_NAME |
target_postgres |
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file elx-0.2.0.tar.gz
.
File metadata
- Download URL: elx-0.2.0.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.10.12 Linux/6.2.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4461dc72046532354cfcd691a0f657cf9eff0fc0d59420f5463df8ae1fdef84c |
|
MD5 | 116b7716c43bd7f425b067ffd07ad337 |
|
BLAKE2b-256 | 22803b915075bd26850c4021f9baad33d5d748aa7f3b019afc7c3834fe10554e |
File details
Details for the file elx-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: elx-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.10.12 Linux/6.2.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93ed4684d611925e687ddfea7f83be3a714d40906e59114eb823d1360db7689a |
|
MD5 | 335240ac6fd967a36e6f52571191ac29 |
|
BLAKE2b-256 | ab96343f6c45464731bf4ec18a89d967600257d2e52f2cc1a509cd7f511bf18a |