-
Notifications
You must be signed in to change notification settings - Fork 710
Description
Hi,
Is it possible to specify a schema when trying to write data to an rds postgres database?
During creation of the connection, for example:
rds_connection = wr.data_api.rds.RdsDataApi(
resource_arn="arn:aws:rds:eu-west-2:XXXXXX:cluster:XXXXXX",
secret_arn="XXXXXXX",
database="my-db",
)
Is not possible to specify a schema, other than using the public one which comes by default. I have another schema with other tables.
When trying to write using:
wr.data_api.rds.to_sql(
df=df,
con=rds_connection,
table=table_name,
database=db_name,
mode=mode,
index=False,
dtype=schema_overrides,
sql_mode="ansi",
use_column_names=True,
)
Is not possible either to specify the schema name, if I try to use the schema name and pass it to database
I get an error, so that should match the value in the rds_connection
creation.
When looking at awswrangler.data_api.rds.py
module, I can see in the to_sql
function that when creating a transaction (line 449), before proceeding with the write to the rds, .begin_transaction()
also accepts schema
parameter:
transaction_id = con.begin_transaction(database=database) # this also accepts `schema`
How can I specify the schema when calling .to_sql() call?
P.S. Please do not attach files as it's considered a security risk. Add code snippets directly in the message body as much as possible.