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

Preping connection to external database. Silently restore broken conn… #144

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

shvbox
Copy link

@shvbox shvbox commented Feb 18, 2019

…ection. Fix wrong id when inserting with external database.

What does this PR do and why is it necessary?

  1. Silently reconnect to external database when connection was broken. Use of pool_pre_ping option of SqlAlchemy 1.2
  2. When connected to external PostgreSql database result.lastrowid allways returns 0. With SQLite all is fine. Using result.inserted_primary_key[0] works as expected for both databases.

How was it tested? How can it be tested by the reviewer?

Tested on my farm.

Any background context you want to provide?

https://stackoverflow.com/questions/23747742/sqlalchemy-session-reconnect
https://stackoverflow.com/questions/8589674/sqlalchemy-getting-the-id-of-the-last-record-inserted

What are the relevant tickets if any?

#108

Screenshots (if appropriate)

Further notes

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

1 participant