Target Core
Singer target-core provide safe tools to easily build new targets following the Singer spec convention and protocol.
How to use it
target-core is a Singer Target which intend to work with regular Singer Tap.
The Goal is to use this package as a foundation to build other taps focusing on the core tools, reducing the energy spent on maintaining the common parts.
Packages extending the target-core
Install
First, make sure Python 3 is installed on your system or follow these installation instructions for Mac or Ubuntu.
It's recommended to use a venv:
Defaults
python -m venv venv
. venv/bin/activate
pip install --upgrade target-core
Head
python -m venv venv
. venv/bin/activate
pip install --upgrade https+git@gitlab.com:omegax/target-core.git
Isolated virtual environment
python -m venv ~/.virtualenvs/target-core
~/.virtualenvs/target-core/bin/pip install target-core
Alternative
python -m venv ~/.virtualenvs/target-core
source ~/.virtualenvs/target-core/bin/activate
pip install target-core
deactivate
To run
Like any other target that's following the singer specificiation:
some-singer-tap | target-core --config [config.json]
It's reading incoming messages from STDIN and using the properites in config.json to upload the data.
Note: To avoid version conflicts run tap and targets in separate virtual environments.
Configuration settings
Running the the target connector requires a config.json file. An example with the minimal settings:
{
"path_template": "{stream}_{date_time:%Y%m%d_%H%M%S}_part_{part:0>3}.json"
}
Profile based authentication
Profile based authentication used by default using the default profile. To use another profile set aws_profile parameter in config.json or set the AWS_PROFILE environment variable.
Non-Profile based authentication
For non-profile based authentication set aws_access_key_id , aws_secret_access_key and optionally the aws_session_token parameter in the config.json. Alternatively you can define them out of config.json by setting AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN environment variables.
Full list of options in config.json:
| Property | Type | Mandatory? | Description |
|---|---|---|---|
| path_template | String | (Default: None) Custom naming convention of the s3 key. Replaces tokens stream, and date_time with the appropriate values.Supports datetime and other python advanced string formatting e.g. {stream}_{date_time:%FT%T.%f}.jsonl or {stream:_>8}/{date_time:%Y}/{date_time:%m}/{date_time:%d}/{date_time:%Y%m%d_%H%M%S_%f}.json.Supports "folders" in s3 keys e.g. my_folder/my_sub_folder/{stream}/export_date={date}/{date_time}.json. |
|
| timezone_offset | Integer | Offset value in hour. Use offset 0 hours is you want the path_template to use utc time zone. The null values is used by default. |
|
| memory_buffer | Integer | Memory buffer's size used before storing the data into the temporary file. 64Mb used by default if unspecified. This value is used to partition the files by size. | |
| file_size | Integer | File size limit. File parts will be created. The path_template must contain a part section for the part number. Example "path_template": "{stream}_{date_time:%Y%m%d_%H%M%S}_part_{part:0>3}.json". |
|
| work_dir | String | (Default: platform-dependent) Directory of temporary JSONL files with RECORD messages. | |
| compression | String | The type of compression to apply before uploading. Supported options are none (default), gzip, and lzma. For gzipped files, the file extension will automatically be changed to .json.gz for all files. For lzma compression, the file extension will automatically be changed to .json.xz for all files. |
Test
Install the tools
pip install .[test,lint]
Run pytest
pytest -p no:cacheprovider
Lint
flake8 --show-source --statistics --count --extend-exclude .virtualenvs
Release
- Update the version number at the beginning of
target-core/target_core/__init__.py - Merge the changes PR into
main - Create a tag
git tag -a 1.0.0 -m 'Release version 1.0.0' - Release the new version in github
License
Apache License Version 2.0
Metadata
Release files for target-core 0.1.0
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 |
|---|---|---|---|---|
| target-core-0.1.0.tar.gz | 28.3 kB | Without provenance | Details for target-core-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| target_core-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for target_core-0.1.0-py3-none-any.whl |
Total release size: 51.8 kB
Release files / target-core-0.1.0.tar.gz
| Download URL | target-core-0.1.0.tar.gz |
|---|---|
| Size | 28.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c07a8df10d56c0e443650e2379b6f39f84e4c918545a85dc228e73e1464f6793
|
|
BLAKE2b-256 checksum How to use checksums |
f0b5548cd4cd4c5e2eb15beaf49babf2c6751e8b06c13f456c8b66919d66539d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0
|
Release files / target_core-0.1.0-py3-none-any.whl
| Download URL | target_core-0.1.0-py3-none-any.whl |
|---|---|
| Size | 23.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
417c20a516cb14bffba9b40d64dfe32dd8107eeca18c9a5fb9efa501d32d6db7
|
|
BLAKE2b-256 checksum How to use checksums |
876ae0e50903492635257fc41649110a84f8648d8f44a872c5a23d7ad48dc334
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0
|
Security for target-core 0.1.0
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.