IODA migration
==============

Generation of CSV files for migration of IODA assets.

Script queries RedShift table with data, imported from
asset_full_report_IODA_L.csv YouTube report with IODA assets and
 generate CSV files, according to YouTube CSV template (https://goo.gl/aE8JIp)

Each CSV file contains 1000 of assets.

## Getting Started

### Installation

The installation is very straightforward, but make sure you are using at least
python 3.4. If you use a Mac, you can install it using `brew`. If you use
Windows, just ask for a remote VM that has it installed for you.

```bash
$ pyvenv env
(env) $ . env/bin/activate
(env) $ pip install -r requirements.txt
```

Copy .env.shadow to .env and add the appropriate environement variables for your
environment. You need to setup connection parameters for production RedShift cluster.

```bash
$ cp .env.shadow .env
```

### Running

**Important!**
Before running the script you have to recreate a materialized view on production DB.
Please, run the following script `sql_scripts/ioda_assets_csv_export_report.sql` over production RedShift.


When all dependencies have been installed, you can run the script
on your local instance by running:

```bash
(env) $ python main.py
```
