pandas와 Python 커넥터 통합 - Amazon Redshift

pandas와 Python 커넥터 통합

다음은 Python 커넥터를 pandas와 통합하는 예입니다.

>>> import pandas #Connect to the cluster >>> import redshift_connector >>> conn = redshift_connector.connect( host='examplecluster.abc123xyz789.us-west-1.redshift.amazonaws.com', port=5439, database='dev', user='awsuser', password='my_password' ) # Create a Cursor object >>> cursor = conn.cursor() # Query and receive result set cursor.execute("select * from book") result: pandas.DataFrame = cursor.fetch_dataframe() print(result)