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

[DOP-9208] Fix calling .close() method in __del__ #156

Merged
merged 1 commit into from
Sep 26, 2023
Merged

Conversation

dolfinus
Copy link
Member

@dolfinus dolfinus commented Sep 25, 2023

Change Summary

  • Wrap resetting value of self._last_connection_and_options in JDBCMixin with contextlib.suppress to avoid showing error messages while stopping Python interpreter.
  • Make self._last_connection_and_options thread-local variable. This allows to create separated connections to database in different Python threads, instead of using global connection object.
  • Call .close() method while deleting FileConnection instance by garbage collector. Add notes why this should not be used in some other connection classes, like FileDF and Kafka.

Related issue number

Checklist

  • Commit message and PR title is comprehensive
  • Keep the change as small as possible
  • Unit and integration tests for the changes exist
  • Tests pass on CI and coverage does not decrease
  • Documentation reflects the changes where applicable
  • docs/changelog/next_release/<pull request or issue id>.<change type>.rst file added describing change
    (see CONTRIBUTING.rst for details.)
  • My PR is ready to review.

@dolfinus dolfinus temporarily deployed to test-pypi September 25, 2023 13:10 — with GitHub Actions Inactive
@dolfinus dolfinus temporarily deployed to test-pypi September 25, 2023 13:16 — with GitHub Actions Inactive
@dolfinus dolfinus self-assigned this Sep 25, 2023
@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Merging #156 (b53a748) into develop (6313b12) will increase coverage by 0.11%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop     #156      +/-   ##
===========================================
+ Coverage    94.30%   94.41%   +0.11%     
===========================================
  Files          208      208              
  Lines         7775     7790      +15     
  Branches      1465     1472       +7     
===========================================
+ Hits          7332     7355      +23     
+ Misses         322      315       -7     
+ Partials       121      120       -1     
Files Changed Coverage Δ
onetl/connection/db_connection/kafka/connection.py 98.98% <ø> (+1.01%) ⬆️
.../connection/db_connection/jdbc_mixin/connection.py 95.55% <100.00%> (+0.10%) ⬆️
...netl/connection/file_connection/file_connection.py 93.81% <100.00%> (+0.13%) ⬆️
...ection/file_df_connection/spark_hdfs/connection.py 100.00% <100.00%> (+5.26%) ⬆️
...nnection/file_df_connection/spark_s3/connection.py 92.66% <100.00%> (+0.09%) ⬆️

@dolfinus dolfinus temporarily deployed to test-pypi September 25, 2023 13:39 — with GitHub Actions Inactive
@dolfinus dolfinus marked this pull request as ready for review September 25, 2023 13:59
@dolfinus dolfinus merged commit f3aa335 into develop Sep 26, 2023
36 checks passed
@dolfinus dolfinus deleted the bugfix/DOP-9208 branch September 26, 2023 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants