Skip to content

Commit

Permalink
initial dev
Browse files Browse the repository at this point in the history
  • Loading branch information
crowemi committed Oct 29, 2022
0 parents commit eed50b5
Show file tree
Hide file tree
Showing 17 changed files with 1,854 additions and 0 deletions.
139 changes: 139 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Secrets and internal config files
.secrets/*

# Ignore meltano internal cache and sqlite systemdb

.meltano/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# ide
.vscode
10 changes: 10 additions & 0 deletions .secrets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# IMPORTANT! This folder is hidden from git - if you need to store config files or other secrets,
# make sure those are never staged for commit into your git repo. You can store them here or another
# secure location.
#
# Note: This may be redundant with the global .gitignore for, and is provided
# for redundancy. If the `.secrets` folder is not needed, you may delete it
# from the project.

*
!.gitignore
132 changes: 132 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# target-s3

`target-s3` is a Singer target for s3.

Build with the [Meltano Target SDK](https://sdk.meltano.com).

<!--
Developer TODO: Update the below as needed to correctly describe the install procedure. For instance, if you do not have a PyPi repo, or if you want users to directly install from your git repo, you can modify this step as appropriate.
## Installation
Install from PyPi:
```bash
pipx install target-s3
```
Install from GitHub:
```bash
pipx install git+https://github.com/ORG_NAME/target-s3.git@main
```
-->

## Configuration

### Accepted Config Options

<!--
Developer TODO: Provide a list of config options accepted by the target.
This section can be created by copy-pasting the CLI output from:
```
target-s3 --about --format=markdown
```
-->

A full list of supported settings and capabilities for this
target is available by running:

```bash
target-s3 --about
```

### Configure using environment variables

This Singer target will automatically import any environment variables within the working directory's
`.env` if the `--config=ENV` is provided, such that config values will be considered if a matching
environment variable is set either in the terminal context or in the `.env` file.

### Source Authentication and Authorization

<!--
Developer TODO: If your target requires special access on the destination system, or any special authentication requirements, provide those here.
-->

## Usage

You can easily run `target-s3` by itself or in a pipeline using [Meltano](https://meltano.com/).

### Executing the Target Directly

```bash
target-s3 --version
target-s3 --help
# Test using the "Carbon Intensity" sample:
tap-carbon-intensity | target-s3 --config /path/to/target-s3-config.json
```

## Developer Resources

Follow these instructions to contribute to this project.

### Initialize your Development Environment

```bash
pipx install poetry
poetry install
```

### Create and Run Tests

Create tests within the `target_s3/tests` subfolder and
then run:

```bash
poetry run pytest
```

You can also test the `target-s3` CLI interface directly using `poetry run`:

```bash
poetry run target-s3 --help
```

### Testing with [Meltano](https://meltano.com/)

_**Note:** This target will work in any Singer environment and does not require Meltano.
Examples here are for convenience and to streamline end-to-end orchestration scenarios._

<!--
Developer TODO:
Your project comes with a custom `meltano.yml` project file already created. Open the `meltano.yml` and follow any "TODO" items listed in
the file.
-->

Next, install Meltano (if you haven't already) and any needed plugins:

```bash
# Install meltano
pipx install meltano
# Initialize meltano within this directory
cd target-s3
meltano install
```

Now you can test and orchestrate using Meltano:

```bash
# Test invocation:
meltano invoke target-s3 --version
# OR run a test `elt` pipeline with the Carbon Intensity sample tap:
meltano elt tap-carbon-intensity target-s3
```

### SDK Dev Guide

See the [dev guide](https://sdk.meltano.com/en/latest/dev_guide.html) for more instructions on how to use the Meltano Singer SDK to
develop your own Singer taps and targets.
10 changes: 10 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"aws_region": "us-west-2",
"object_type": "parquet",
"bucket": "00-data-lake",
"prefix": "dev/fluro",
"append_date_to_prefix": true,
"append_date_to_prefix_grain": "month",
"max_file_record_size": 10000,
"max_file_size": 10000
}
6 changes: 6 additions & 0 deletions input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{"type": "SCHEMA", "stream": "users", "key_properties": ["id"], "schema": {"required": ["id"], "type": "object", "properties": {"id": {"type": "integer"}, "name": {"type": "string"}}}}
{"type": "RECORD", "stream": "users", "record": {"id": 1, "name": "frank"}}
{"type": "RECORD", "stream": "users", "record": {"id": 2, "name": "mike"}}
{"type": "SCHEMA", "stream": "locations", "key_properties": ["id"], "schema": {"required": ["id"], "type": "object", "properties": {"id": {"type": "integer"}, "name": {"type": "string"}}}}
{"type": "RECORD", "stream": "locations", "record": {"id": 1, "name": "tom"}}
{"type": "STATE", "value": {"users": 2, "locations": 1}}
25 changes: 25 additions & 0 deletions meltano.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 1
send_anonymous_usage_stats: false
project_id: "target-s3"
default_environment: test
environments:
- name: test
plugins:
extractors: []
loaders:
- name: "target-s3"
namespace: "target_s3"
pip_url: -e .
capabilities:
- about
- stream-maps
- record-flattening
config:
start_date: "2010-01-01T00:00:00Z"
settings:
# TODO: To configure using Meltano, declare settings and their types here:
- name: username
- name: password
kind: password
- name: start_date
value: "2010-01-01T00:00:00Z"
Loading

0 comments on commit eed50b5

Please sign in to comment.