{ "info": { "author": "TransferWise", "author_email": "", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3 :: Only" ], "description": "# pipelinewise-target-redshift\n\n[![PyPI version](https://badge.fury.io/py/pipelinewise-target-redshift.svg)](https://badge.fury.io/py/pipelinewise-target-redshift)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pipelinewise-target-redshift.svg)](https://pypi.org/project/pipelinewise-target-redshift/)\n[![License: Apache2](https://img.shields.io/badge/License-Apache2-yellow.svg)](https://opensource.org/licenses/Apache-2.0)\n\n[Singer](https://www.singer.io/) target that loads data into Amazon Redshift following the [Singer spec](https://github.com/singer-io/getting-started/blob/master/docs/SPEC.md).\n\nThis is a [PipelineWise](https://transferwise.github.io/pipelinewise) compatible target connector.\n\n## How to use it\n\nThe recommended method of running this target is to use it from [PipelineWise](https://transferwise.github.io/pipelinewise). When running it from PipelineWise you don't need to configure this tap with JSON files and most of things are automated. Please check the related documentation at [Target Redshift](https://transferwise.github.io/pipelinewise/connectors/targets/redshift.html)\n\nIf you want to run this [Singer Target](https://singer.io) independently please read further.\n\n## Install\n\nFirst, make sure Python 3 is installed on your system or follow these\ninstallation instructions for [Mac](http://docs.python-guide.org/en/latest/starting/install3/osx/) or\n[Ubuntu](https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-ubuntu-16-04).\n\nIt's recommended to use a virtualenv:\n\n```bash\n python3 -m venv venv\n . venv/bin/activate\n pip install --upgrade pip\n pip install pipelinewise-target-redshift\n```\n\nor\n\n```bash\n python3 -m venv venv\n . venv/bin/activate\n pip install --upgrade pip\n pip install .\n```\n\n### To run\n\nLike any other target that's following the singer specificiation:\n\n`some-singer-tap | target-redshift --config [config.json]`\n\nIt's reading incoming messages from STDIN and using the properites in `config.json` to upload data into Amazon Redshift.\n\n**Note**: To avoid version conflicts run `tap` and `targets` in separate virtual environments.\n\n### Configuration settings\n\nRunning the the target connector requires a `config.json` file. Example with the minimal settings:\n\n ```json\n {\n\n \"host\": \"xxxxxx.redshift.amazonaws.com\",\n \"port\": 5439,\n \"user\": \"my_user\",\n \"password\": \"password\",\n \"dbname\": \"database_name\",\n \"aws_access_key_id\": \"secret\",\n \"aws_secret_access_key\": \"secret\",\n \"s3_bucket\": \"bucket_name\",\n \"default_target_schema\": \"my_target_schema\"\n }\n ```\n\nFull list of options in `config.json`:\n\n| Property | Type | Required? | Description |\n|-------------------------------------|---------|------------|---------------------------------------------------------------|\n| host | String | Yes | Redshift Host |\n| port | Integer | Yes | Redshift Port |\n| user | String | Yes | Redshift User |\n| password | String | Yes | Redshift Password |\n| dbname | String | Yes | Redshift Database name |\n| aws_access_key_id | String | No | S3 Access Key Id. Used for S3 and Redshfit copy operations. If not provided, credentials will be collected from the environment |\n| aws_secret_access_key | String | No | S3 Secret Access Key. Used for S3 and Redshfit copy operations. If not provided, credentials will be collected from the environment |\n| aws_session_token | String | No | S3 AWS STS token for temporary credentials |\n| aws_redshift_copy_role_arn | String | No | AWS Role ARN to be used for the Redshift COPY operation. Used instead of the given AWS keys for the COPY operation if provided - the keys are still used for other S3 operations |\n| s3_bucket | String | Yes | S3 Bucket name |\n| s3_key_prefix | String | | (Default: None) A static prefix before the generated S3 key names. Using prefixes you can upload files into specific directories in the S3 bucket. |\n| copy_options | String | | (Default: `EMPTYASNULL BLANKSASNULL TRIMBLANKS TRUNCATECOLUMNS TIMEFORMAT 'auto' COMPUPDATE OFF STATUPDATE OFF`). Parameters to use in the COPY command when loading data to Redshift. Some basic file formatting parameters are fixed values and not recommended overriding them by custom values. They are like: `CSV GZIP DELIMITER ',' REMOVEQUOTES ESCAPE` |\n| batch_size | Integer | | (Default: 100000) Maximum number of rows in each batch. At the end of each batch, the rows in the batch are loaded into Redshift. |\n| parallelism | Integer | | (Default: no. of CPUs) The maximum parallelism to load streams into Redshift. Desirable if running in a container on a host which has many more CPUs than are allocated to the container, as Python will infer the number of CPUs as the number of host CPUs. |\n| default_target_schema | String | | Name of the schema where the tables will be created. If `schema_mapping` is not defined then every stream sent by the tap is loaded into this schema. |\n| default_target_schema_select_permission | String | | Grant USAGE privilege on newly created schemas and grant SELECT privilege on newly created tables to a specific list of users or groups. Example: `{\"users\": [\"user_1\",\"user_2\"], \"groups\": [\"group_1\", \"group_2\"]}` If `schema_mapping` is not defined then every stream sent by the tap is granted accordingly. |\n| schema_mapping | Object | | Useful if you want to load multiple streams from one tap to multiple Redshift schemas.

If the tap sends the `stream_id` in `-` format then this option overwrites the `default_target_schema` value. Note, that using `schema_mapping` you can overwrite the `default_target_schema_select_permission` value to grant SELECT permissions to different groups per schemas or optionally you can create indices automatically for the replicated tables.

**Note**: This is an experimental feature and recommended to use via PipelineWise YAML files that will generate the object mapping in the right JSON format. For further info check a [PipelineWise YAML Example]\n| disable_table_cache | Boolean | | (Default: False) By default the connector caches the available table structures in Redshift at startup. In this way it doesn't need to run additional queries when ingesting data to check if altering the target tables is required. With `disable_table_cache` option you can turn off this caching. You will always see the most recent table structures but will cause an extra query runtime. |\n| add_metadata_columns | Boolean | | (Default: False) Metadata columns add extra row level information about data ingestions, (i.e. when was the row read in source, when was inserted or deleted in redshift etc.) Metadata columns are creating automatically by adding extra columns to the tables with a column prefix `_SDC_`. The metadata columns are documented at https://transferwise.github.io/pipelinewise/data_structure/sdc-columns.html. Enabling metadata columns will flag the deleted rows by setting the `_SDC_DELETED_AT` metadata column. Without the `add_metadata_columns` option the deleted rows from singer taps will not be recongisable in Redshift. |\n| hard_delete | Boolean | | (Default: False) When `hard_delete` option is true then DELETE SQL commands will be performed in Redshift to delete rows in tables. It's achieved by continuously checking the `_SDC_DELETED_AT` metadata column sent by the singer tap. Due to deleting rows requires metadata columns, `hard_delete` option automatically enables the `add_metadata_columns` option as well. |\n| data_flattening_max_level | Integer | | (Default: 0) Object type RECORD items from taps can be loaded into VARIANT columns as JSON (default) or we can flatten the schema by creating columns automatically.

When value is 0 (default) then flattening functionality is turned off. |\n\n\n### To run tests:\n\n1. Install python dependencies in a virtual env:\n\n\n```bash\n python3 -m venv venv\n . venv/bin/activate\n pip install --upgrade pip\n pip install .\n pip install pytest coverage\n```\n\n1. To run unit tests:\n\n\n```bash\n coverage run -m pytest --disable-pytest-warnings tests/unit && coverage report\n```\n\n1. To run integration tests define environment variables first:\n\n```bash\n export TARGET_REDSHIFT_HOST=\n export TARGET_REDSHIFT_PORT=\n export TARGET_REDSHIFT_USER=\n export TARGET_REDSHIFT_PASSWORD=\n export TARGET_REDSHIFT_DBNAME=\n export TARGET_REDSHIFT_SCHEMA=\n export TARGET_REDSHIFT_AWS_ACCESS_KEY=\n export TARGET_REDSHIFT_AWS_SECRET_ACCESS_KEY=\n export TARGET_REDSHIFT_S3_BUCKET=\n export TARGET_REDSHIFT_S3_KEY_PREFIX=\n\n coverage run -m pytest --disable-pytest-warnings tests/integration && coverage report\n```\n\n### To run pylint:\n\n1. Install python dependencies and run python linter\n\n\n```bash\n python3 -m venv venv\n . venv/bin/activate\n pip install --upgrade pip\n pip install .\n pip install pylint\n pylint target_redshift -d C,W,unexpected-keyword-arg,duplicate-code\n```\n\n## License\n\nApache License Version 2.0\n\nSee [LICENSE](LICENSE) to see the full text.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/transferwise/pipelinewise-target-redshift", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pipelinewise-target-redshift", "package_url": "https://pypi.org/project/pipelinewise-target-redshift/", "platform": "", "project_url": "https://pypi.org/project/pipelinewise-target-redshift/", "project_urls": { "Homepage": "https://github.com/transferwise/pipelinewise-target-redshift" }, "release_url": "https://pypi.org/project/pipelinewise-target-redshift/1.0.8/", "requires_dist": null, "requires_python": "", "summary": "Singer.io target for loading data to Amazon Redshift - PipelineWise compatible", "version": "1.0.8" }, "last_serial": 5929001, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "bff45f682d8a502aeef6de386d6b267c", "sha256": "9f237dac9abf505027128b8a2af88d5a755eb78d94be96929e83ace2a21a5e1a" }, "downloads": -1, "filename": "pipelinewise-target-redshift-1.0.0.tar.gz", "has_sig": false, "md5_digest": "bff45f682d8a502aeef6de386d6b267c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13093, "upload_time": "2019-07-22T09:00:32", "url": "https://files.pythonhosted.org/packages/5f/bc/5bd77dc3c7edf2b77c3f9f0ba89baa1495ef202c91649b26ccd1ff2bd25f/pipelinewise-target-redshift-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "8f98984da8e16bec1bf12488e5261de5", "sha256": "a905fd3f13bd646fe6c972847d254955c4d8fdb07725c21dc1315ae098aa21c7" }, "downloads": -1, "filename": "pipelinewise-target-redshift-1.0.1.tar.gz", "has_sig": false, "md5_digest": "8f98984da8e16bec1bf12488e5261de5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13086, "upload_time": "2019-08-10T23:17:54", "url": "https://files.pythonhosted.org/packages/9f/33/dc15943f0c3a7708e1125794af9e6a00c50fb545ec86a59f85462e213b25/pipelinewise-target-redshift-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "f536cef69af45fd46e93fdf0426e1617", "sha256": "2a18046f7c3965d17a7562e53c5a8803dd44a6fe608f9d9c24988bf94c20916a" }, "downloads": -1, "filename": "pipelinewise-target-redshift-1.0.2.tar.gz", "has_sig": false, "md5_digest": "f536cef69af45fd46e93fdf0426e1617", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13093, "upload_time": "2019-08-11T11:07:43", "url": "https://files.pythonhosted.org/packages/43/0a/955564112b9471134036b983f6910a0a72fd5454009e546e1cbf355cda8f/pipelinewise-target-redshift-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "d19612b5a9f1b62652ed56669ebea42e", "sha256": "87f433f176cbca1c02e5b2a8f30e6b49fd33c74631982d5d874d458e20ba1ad0" }, "downloads": -1, "filename": "pipelinewise-target-redshift-1.0.3.tar.gz", "has_sig": false, "md5_digest": "d19612b5a9f1b62652ed56669ebea42e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13155, "upload_time": "2019-08-16T15:56:42", "url": "https://files.pythonhosted.org/packages/da/93/d1577df341502dbcb082cfa4f096453c37a57899dcb7a76f14c36b0dc500/pipelinewise-target-redshift-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "b5205d08437d1dbe46d80e45e0d0e5d1", "sha256": "2f70858f248a2d7189179b134e349d1fbda7cb972967b29f94b7053edc84b538" }, "downloads": -1, "filename": "pipelinewise-target-redshift-1.0.4.tar.gz", "has_sig": false, "md5_digest": "b5205d08437d1dbe46d80e45e0d0e5d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13314, "upload_time": "2019-09-08T20:24:03", "url": "https://files.pythonhosted.org/packages/ca/57/e7a1a04c375f0b2387fa94806bf45eab598654bde682cdde19b3b80d3de6/pipelinewise-target-redshift-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "9065c01dd752a750fca80b149623e62d", "sha256": "08e893ba7d4a67e3d15b865b01bbf34ff05ec257ba8e5a5d735ede82419cfbe1" }, "downloads": -1, "filename": "pipelinewise-target-redshift-1.0.5.tar.gz", "has_sig": false, "md5_digest": "9065c01dd752a750fca80b149623e62d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13316, "upload_time": "2019-09-08T21:17:59", "url": "https://files.pythonhosted.org/packages/87/79/84e966479320af12c076372472e1246413429e26ff1fda1ea6ada4a08638/pipelinewise-target-redshift-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "019ff214703e88c9ea5af92c155ea53a", "sha256": "1045d1d12368744e5d7b18965afe8b7557056eae099dc12aec0b27949ea00f54" }, "downloads": -1, "filename": "pipelinewise-target-redshift-1.0.6.tar.gz", "has_sig": false, "md5_digest": "019ff214703e88c9ea5af92c155ea53a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13312, "upload_time": "2019-09-19T09:51:14", "url": "https://files.pythonhosted.org/packages/b0/0b/21cd347886889186ac2aaac9cabc25e0a509b1477c41f5cab8d77bf234f0/pipelinewise-target-redshift-1.0.6.tar.gz" } ], "1.0.7": [ { "comment_text": "", "digests": { "md5": "26b6d0f4986167d8e914c44bb0c50ade", "sha256": "b4767de46e38afedb4ecb8f886d2f1e5e4d67dd185894c5037cb09ee6d6a5ec2" }, "downloads": -1, "filename": "pipelinewise-target-redshift-1.0.7.tar.gz", "has_sig": false, "md5_digest": "26b6d0f4986167d8e914c44bb0c50ade", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13946, "upload_time": "2019-10-01T17:59:59", "url": "https://files.pythonhosted.org/packages/d1/4f/a0a552dc847a29609ba5cd9d1239fa067c1f7d3085a1e351562c9f78c704/pipelinewise-target-redshift-1.0.7.tar.gz" } ], "1.0.8": [ { "comment_text": "", "digests": { "md5": "fdce3553a36b548fdfcaabad849a4364", "sha256": "818115bed519986ad2e5e7528b19d187ffa54c6791c70e1770b66b813e3305ca" }, "downloads": -1, "filename": "pipelinewise-target-redshift-1.0.8.tar.gz", "has_sig": false, "md5_digest": "fdce3553a36b548fdfcaabad849a4364", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14609, "upload_time": "2019-10-04T15:35:21", "url": "https://files.pythonhosted.org/packages/0e/e3/386866c1233fc7bb2e17c6d280cfbce872afaeacd585721a1a8b1e2cd6b6/pipelinewise-target-redshift-1.0.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fdce3553a36b548fdfcaabad849a4364", "sha256": "818115bed519986ad2e5e7528b19d187ffa54c6791c70e1770b66b813e3305ca" }, "downloads": -1, "filename": "pipelinewise-target-redshift-1.0.8.tar.gz", "has_sig": false, "md5_digest": "fdce3553a36b548fdfcaabad849a4364", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14609, "upload_time": "2019-10-04T15:35:21", "url": "https://files.pythonhosted.org/packages/0e/e3/386866c1233fc7bb2e17c6d280cfbce872afaeacd585721a1a8b1e2cd6b6/pipelinewise-target-redshift-1.0.8.tar.gz" } ] }