python 链接redshift数据库

%matplotlib inline  
import pandas as pd
from sqlalchemy import create_engine
import matplotlib.pyplot as plt
import datetime
#import seaborn
import numpy as np
from scipy.stats import t
import inspect
engine = create_engine("postgresql://milin:Milin123@jiayundatatest.cls0csjdlwvj.us-west-2.redshift.amazonaws.com:5439/yayundata")

data = pd.read_sql(
    """
    select * from test.cbb_cod  where order_day >= '2018-08-21' and order_day <= '2018-09-03'
    
    """,engine)

data.to_csv('cod0903.csv',encoding='UTF-8')

你可能感兴趣的:(python 链接redshift数据库)