Skip to main content

Singer.io utility library - PipelineWise and Meltano compatible

Project description

pipelinewise-singer-python

PyPI version PyPI - Python Version License: MIT

Writes the Singer format from Python.

This is a fork of Singer's singer-python made for PipelineWise.

Usage

Setup environment

This library depends on python3. We recommend using a virtualenv like this:

python3 -m venv ~/.virtualenvs/singer-python

Installation

Next, install this library:

source ~/.virtualenvs/singer-python/bin/activate
git clone http://github.com/singer-io/singer-python
cd singer-python
pip install

Usage example

Now, from python code within the same virtualenv, you can use the library:

import singer

singer.write_schema('my_table',
	            {'properties':{'id': {'type': 'string', 'key': True}}},
		    ['id'])
singer.write_records('my_table',
                     [{'id': 'b'}, {'id':'d'}])
singer.write_state({'my_table': 'd'})

Logging configuration

pipelinewise-singer-python by default doesn't use any predefined logging configuration, it's up to the calling library to define it. However, if the environment variable LOGGING_CONF_FILE is found and set then the pipelinewise-singer-python would use the path provided in the env variable as the logging configuration for the logger.

Singer Decimal

Enabling the use_singer_decimal = True in a tap will output decimal and floats as a string rather than their numeric representation.

Optional Setting:

A boolean setting: when enabled true in the config will outputs decimal and floating point numbers as strings to avoid loss of precision and scale. For supporting taps, there are hints in the schema message, format = "singer.decimal", and additionalProperties scale_precision dictionary providing precision and scale. For decimal data, the target can use this information to correctly replicate decimal data without loss. For the Floats and Number data type without precision and scale it is recommended that post processing formats the datatype based on an inspection of the data because the true data size is unknown / dynamic.

{
  "use_singer_decimal": true,
}

Developer Resources

Initialize your Development Environment

pip install poetry
poetry install

Create and Run Tests

Create tests within the tests/ directory and then run:

poetry run pytest

or

poetry run coverage run --parallel -m pytest

Continuous Integration

Run through the full suite of tests and linters by running

poetry run tox

These must pass in order for PR's to be merged.

License

Distributed under the Apache License Version 2.0

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

realit_singer_python-5.0.0.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

realit_singer_python-5.0.0-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file realit_singer_python-5.0.0.tar.gz.

File metadata

  • Download URL: realit_singer_python-5.0.0.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for realit_singer_python-5.0.0.tar.gz
Algorithm Hash digest
SHA256 63ba3c922e28a3f328cf2cea7a5ba7e3958e77779ddfb100d232564ddaee5c0a
MD5 888837c2c39a426198f6ccee3637061a
BLAKE2b-256 237252e0ee2d70653cbc6da2dfd3f03a753557385e5e6be929f53f8542c335b1

See more details on using hashes here.

File details

Details for the file realit_singer_python-5.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for realit_singer_python-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1fc4fa992c04a6cf659f5fa0029ad1d203a392854b06ea6183dc126d7d21c8f
MD5 f84b28e74cc41577b0500d09fc0a0b5e
BLAKE2b-256 5b123e3b1d22e2111e6e30e613c1604da5bfaebac8e5f601e8685fbe94b1b3c5

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