Skip to content

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

Open
shvbox wants to merge 2 commits into
malnvenshorn:developfrom
shvbox:develop
Open

Preping connection to external database. Silently restore broken conn…#144
shvbox wants to merge 2 commits into
malnvenshorn:developfrom
shvbox:develop

Conversation

@shvbox

@shvbox shvbox commented Feb 18, 2019

Copy link
Copy Markdown

…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

…ection. Fix wrong id when inserting with external database.
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.

1 participant