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

Improving upserts #79

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Commits on Oct 13, 2021

  1. Updating README

    Adding paragraph on schema's in PostgreSQL.
    Joris Gillis committed Oct 13, 2021
    Configuration menu
    Copy the full SHA
    a5d9a09 View commit details
    Browse the repository at this point in the history
  2. Fixing upsert of file

    First, a query is executed to check whether the file
    already exists. If not, it is inserted. If it does exist
    the file is updated.
    
    The current code was given issues because the transaction
    was closed after the failure.
    
    In the future it might be better to use a SQLAlchemy Session
    which handles upserts under the hood.
    Joris Gillis committed Oct 13, 2021
    Configuration menu
    Copy the full SHA
    58194b6 View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2021

  1. Upserting a file

    Using the upsert feature (on_conflict_do_update) of
    SQLAlchemy and PostgreSQL, instead of relying on
    exception handling of an insert statement.
    
    Upsert statements are support from PostgreSQL 9.5
    https://www.postgresql.org/about/press/presskit95/en/
    https://www.postgresql.org/docs/current/sql-insert.html
    Joris Gillis committed Oct 14, 2021
    Configuration menu
    Copy the full SHA
    f28f909 View commit details
    Browse the repository at this point in the history