Skip to main content

SQLAlchemy versions of Django's get_or_create() and update_or_create()

Project description

SQLAlchemy get_or_create()

SQLAlchemy versions of Django’s get_or_create() and update_or_create()

Installation

To get the latest stable release from PyPi

pip install sqlalchemy_get_or_create

Usage

get_or_create(session, model, defaults=None, **kwargs)

Same as Django’s get_or_create() but also takes the SQLAlchemy session and model

update_or_create(session, model, defaults=None, **kwargs)

Same as Django’s update_or_create() but also takes the SQLAlchemy session and model

Acknowledgments

  1. Django

  2. Some code cribbed from https://skien.cc/blog/2014/01/15/sqlalchemy-and-race-conditions-implementing-get_one_or_create/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlalchemy_get_or_create-0.1.5.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

sqlalchemy_get_or_create-0.1.5-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page