Instantly share code, notes, and snippets.

View loaddata.py
import pandas_redshift as pr
pr.connect_to_redshift(dbname = 'YOU_DATABASE', host = 'YOUR_HOST', port = 'YOUR_PORT',
user = 'YOUR_USER', password = 'YOUR PASSWORD')
pr.connect_to_s3(aws_access_key_id = 'YOUR_ACCESS_KEY_ID', aws_secret_access_key = 'YOUR_aCCESS_KEY',
bucket = 'BUCKET_TO_LOAD')
pr.pandas_to_redshift(data_frame = 'DATA_FRAME_TO_LOAD', redshift_table_name = 'TABLE_IN_REDSHIFT_TO_LOAD')
View members.py
fields = 'members.client,members.last_changed,members.list_id,members.rating,members.email_address,members.merge_fields.uuid,members.stats,members.status,members.member_rating,members.timestamp_opt'
client.lists.members.all(list_id = '29hfkl23' , count = 20, offset = 0 , fields = fields)['members']
View retrive lists.py
lists = client.lists.all(get_all=True, fields="lists.name,lists.id")['lists']
#get_all intends to provide you with all the available lists
#fields are the collumns you want to extract
View import libraries.py
from mailchimp3 import MailChimp
import pandas as pd
client = MailChimp(mc_api='YOUR_API_KEY', mc_user='YOUR_USERNAME')