Unload utility for Amazon Redshift
Project description
# redshift-unloader
Unloads the result of a query on Amazon Redshift to local storage.
## Prerequisites
- Python 3.6+
- boto3 1.7.84
- psycopg2 2.7.5
- psycopg2-binary 2.7.5
## Installation
The package is available on PyPI:
```bash
pip install redshift-unloader
```
### Usage
Unloaded data is supposed to be gzipped csv.
```py
from redshift_unloader import RedshiftUnloader
ru = RedshiftUnloader(host='<redshift host>',
port=<redshift port>,
user='<redshift user>',
password='<redshift password>',
database='<redshift database name>',
s3_bucket='<s3 bucket name>',
access_key_id='<aws access key id>',
secret_access_key='<aws secret access key>',
region='<aws region>',
verbose=False)
# If you don't need header, set with_header as False
ru.unload(query="SELECT * FROM my_table WHERE log_time >= ''",
filename="/path/to/result.csv.gz",
with_header=True)
```
Unloads the result of a query on Amazon Redshift to local storage.
## Prerequisites
- Python 3.6+
- boto3 1.7.84
- psycopg2 2.7.5
- psycopg2-binary 2.7.5
## Installation
The package is available on PyPI:
```bash
pip install redshift-unloader
```
### Usage
Unloaded data is supposed to be gzipped csv.
```py
from redshift_unloader import RedshiftUnloader
ru = RedshiftUnloader(host='<redshift host>',
port=<redshift port>,
user='<redshift user>',
password='<redshift password>',
database='<redshift database name>',
s3_bucket='<s3 bucket name>',
access_key_id='<aws access key id>',
secret_access_key='<aws secret access key>',
region='<aws region>',
verbose=False)
# If you don't need header, set with_header as False
ru.unload(query="SELECT * FROM my_table WHERE log_time >= ''",
filename="/path/to/result.csv.gz",
with_header=True)
```
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
Built Distribution
Close
Hashes for redshift_unloader-0.1.2-py36-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0082c767d12de0bc3cee94c5c4a3e1e772ab6a5e8f6bd7accd16dd3f90622ffe |
|
MD5 | 990d27179f4d3488a3034ae6441a736b |
|
BLAKE2b-256 | 8b14f06682604055fd6860d5a4c9a6393bab9b729abd18d40894749694f61b17 |