Skip to main content

Django-psycopg2-extension

Library contains django commands which helps to prepare and manage PostgreSQL database.

Quickstart

Install djjango-psycopg2-extension

pip install skip-django-psycopg2-extension

Add psycopg2_extension to your INSTALLED_APPS:

INSTALLED_APPS = [
    # Django apps...
    'psycopg2_extension',
]

Commands

psqlinit

Django command psqlinit create a database defined in django settings.

You can define specific database settings with standard django DATABASE settings:

DATABASES = {
    'default': {
        ...
        'EXTENSIONS': ['postgis', 'unaccent'],  # extensions to be installed with psqlinit command
        'SNAPSHOT_FILE': Path('data', 'sql', 'local', 'init_default.sql'), # SQL which will be loaded after database initialization
    },
}

Snapshot and extensions are automatically loaded when database is preparing for tests too.

psqlclean

PostgreSQL database requires often call VACUUM and REINDEX. The command psqlclean performs these operations.

You can define specific database settings for psqlclean command with standard django DATABASE settings:

DATABASES = {
    'default': {
        ...
        'VACUUM': {
            'EXCLUDE': ['users_user'],  # list of excluded tables
            'TABLES': ['users_permission'],  # list of tables to vacuum, all tables are selected if the setting is not set
            'TABLES_FULL': ['users_permission'],  # list of tables to vacuum full
            'TABLES_REINDEX': ['users_permission'],  # list of tables to reindex
        }
    },
}

psqlsnapshot

Command which creates SQL dump with pg_dump script and store it to the database 'SNAPSHOT_FILE' setting.

Metadata

Release files for skip-django-psycopg2-extension 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for skip-django-psycopg2-extension 0.2.0
File Size Uploaded
skip_django_psycopg2_extension-0.2.0.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for skip-django-psycopg2-extension 0.2.0
File Interpreter ABI Platform
skip_django_psycopg2_extension-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.7 kB

Release files / skip_django_psycopg2_extension-0.2.0.tar.gz

Download URL skip_django_psycopg2_extension-0.2.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
09c93799e1f8e997fdbc1e10cb5a7549d70f1e46740a5f709b8eb11fd360ed5c
BLAKE2b-256 checksum
How to use checksums
6e9d0c5e3841940bca42930f80cee2c672c0b049485ae28e9b18cf11731aa10c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / skip_django_psycopg2_extension-0.2.0-py3-none-any.whl

Download URL skip_django_psycopg2_extension-0.2.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
004ee191447477f66fe2fbcc265d36bdaab74c374a70c00af35ecb26780ef2e0
BLAKE2b-256 checksum
How to use checksums
801902f788736953c5034c96b2c3c718260e3794efeb0530b693b74090e88e98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page