Feature request: `autocommit` as connector `__init__` property
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.
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
})
That would not work for our case. We are creating and maintaining multiple connections so we need a connection-level autocommit property