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

Updated sample code for connection configuration #1242

Merged
merged 3 commits into from
Oct 10, 2024

Conversation

aidanharan
Copy link
Contributor

Custom connection configuration can now be performed by overriding the additional_connection_configuration method. Previous method as documented did not work.

Addresses issue raised by #1241

@andsip
Copy link
Contributor

andsip commented Oct 10, 2024

Thanks for the quick response and PR @aidanharan.

I can confirm that your proposed change restores the behavior that existed prior to 4842d2e.

There is a use case though which I have, that cannot be solved by this.
That is, I need to adjust the DATEFORMAT setting like so:

@raw_connection.execute("SET DATEFORMAT 'dmy'").do

Since this setting potentially influences the setup in initialize_dateformatter, I would need this setting to be run before initialize_dateformatter.
But with additional_connection_configuration at the end, it will run after.
But we also cannot put this method before in general, as e.g. for the TEXTSIZE setting, it needs to be run after.

That's why I proposed the approach using #prepend in #1241, as with this, the user has more flexibility by calling super before or after the configuration settings.
But maybe there are concerns about using this approach, which I am not aware of.

@aidanharan aidanharan changed the title Changed how additional connection configuration is performed Updated sample code for connection configuration Oct 10, 2024
@aidanharan
Copy link
Contributor Author

Yeah, your approach is better as it gives the user more flexibility as you say. I've updated the README with your code.

@aidanharan aidanharan marked this pull request as ready for review October 10, 2024 14:55
@aidanharan aidanharan merged commit 7dcff73 into main Oct 10, 2024
4 checks passed
@aidanharan aidanharan deleted the additional-connection-configuration branch October 10, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants