@@ -188,6 +188,9 @@ Alternatively, IAM credentials can be supplied directly to ``connect(...)`` usin
188188
189189 Integration with pandas
190190~~~~~~~~~~~~~~~~~~~~~~~
191+
192+ Retrieving query results as a ``pandas.DataFrame ``
193+
191194.. code-block :: python
192195
193196 import pandas
@@ -206,6 +209,28 @@ Integration with pandas
206209 >> 1 A Brief History of Time Stephen Hawking
207210
208211
212+ Insert data stored in a ``pandas.DataFrame `` into an Amazon Redshift table
213+
214+ .. code-block :: python
215+
216+ import numpy as np
217+ import pandas as pd
218+
219+ df = pd.DataFrame(
220+ np.array(
221+ [
222+ [" One Hundred Years of Solitude" , " Gabriel García Márquez" ],
223+ [" A Brief History of Time" , " Stephen Hawking" ],
224+ ]
225+ ),
226+ columns = [" bookname" , " author" ],
227+ )
228+ with db_table.cursor() as cursor:
229+ cursor.write_dataframe(df, " book" )
230+ cursor.execute(" select * from book; " )
231+ result = cursor.fetchall()
232+
233+
209234 Integration with numpy
210235~~~~~~~~~~~~~~~~~~~~~~
211236
@@ -275,10 +300,14 @@ Connection Parameters
275300+-----------------------------------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------+
276301| max_prepared_statements | int | The maximum number of prepared statements that can be open at once | 1000 | No |
277302+-----------------------------------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------+
303+ | partner_sp_id | str | The Partner SP Id used for authentication with Ping | None | No |
304+ +-----------------------------------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------+
278305| port | Int | The port number of the Amazon Redshift cluster | 5439 | No |
279306+-----------------------------------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------+
280307| preferred_role | str | The IAM role preferred for the current connection | None | No |
281308+-----------------------------------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------+
309+ | principal_arn | str | The ARN of the IAM entity (user or role) for which you are generating a policy | None | No |
310+ +-----------------------------------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------+
282311| profile | str | The name of a profile in a AWS credentials file that contains AWS credentials. | None | No |
283312+-----------------------------------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------+
284313| region | str | The AWS region where the cluster is located | None | No |
0 commit comments