Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: autocommit as connector __init__ property #203

Open
avneeshn opened this issue Dec 27, 2023 · 2 comments
Open

Feature request: autocommit as connector __init__ property #203

avneeshn opened this issue Dec 27, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@avneeshn
Copy link

avneeshn commented Dec 27, 2023

Currently, to set autocommit to True, we have to explicitly run:

connection.autocommit = True

Is there a way to pass autocommit as a property to the connector constructor? Something like:

redshift_connector.connect({
   autocommit=True,
   **connection_params
})

We are trying to build an SQL client for our customers with Redshift as one of the underlying data-sources. It would be much cleaner this way avoiding unnecessary if-else conditioning.

@Brooke-white
Copy link
Contributor

Hi @avneeshn , thank you for reaching out with this feature request. Would setting autocommit on the module level work for your use case? Setting autocommit=True on the module level would enable autocommit for subsequent connections. For example

import redshift_connector
redshift_connector.autocommit = True

redshift_connector.connect({ # autocommit is set to True, as specified on the redshift_connector module
   **connection_params
})

redshift_connector.connect({ # again, autocommit is set to True, as specified on the redshift_connector module
   **connection_params
})

@Brooke-white Brooke-white added the enhancement New feature or request label Jan 10, 2024
@avneeshn
Copy link
Author

That would not work for our case. We are creating and maintaining multiple connections so we need a connection-level autocommit property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants