[Python] Connect to AWS RDS with sqlalchemy and read SQL with pandas

Jua KIM·2021년 12월 2일
0

SQL-python

목록 보기
2/3
from sqlalchemy import create_engine 

url = "{AWS rds db url: postgresql://{user}:{password}@{rds endpoint}:{port}/{DB name}}"

engine = create_engine(url)
connect = engine.connect()

query = "select * from {table name}"

# output is pandas dataframe
dataframe = pd.read_sql(query, con=connect)
profile
AI/ML engineer

0개의 댓글