Skip to main content

Singer.io target for inserting data in TerminusDB

Project description

target-terminusdb

This is a Singer target that reads JSON-formatted data following the Singer spec.

To install

target-terminusdb can be install via pip with Python >= 3.7:

python3 -m pip install -U target-terminusdb

To use

You can start a project in a directory using conjunction with TerminusDB easily by:

terminusdb startproject

This will create the config.json that stores information about the endpoint and database that you are connecting to.

Then you can pipe in data using a Singer.io tap to TerminusDB. For details about how to use a Singer.io tap you can see here. For example you have a Python tap like this:

import singer
import urllib.request
from datetime import datetime, timezone

now = datetime.now(timezone.utc).isoformat("T","milliseconds")
schema = {
    'properties':   {
        'ip': {'type': 'string'},
        'timestamp': {'type': 'string', 'format': 'date-time'},
    },
}

with urllib.request.urlopen('http://icanhazip.com') as response:
    ip = response.read().decode('utf-8').strip()
    singer.write_schema('my_ip', schema, 'timestamp')
    singer.write_records('my_ip', [{'timestamp': now, 'ip': ip}])

Then you can use it to put my_ip in TerminusDB like this:

python tap_ip.py | target-terminusdb -c config.json

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

target-terminusdb-0.1.4.tar.gz (16.1 kB view hashes)

Uploaded Source

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