Library contains django commands which helps to prepare and manage PostgreSQL database.
Project description
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.
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
Built Distribution
File details
Details for the file skip-django-psycopg2-extension-0.1.1.2.tar.gz
.
File metadata
- Download URL: skip-django-psycopg2-extension-0.1.1.2.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86862f4c3c6150985228d3cf7cf43d234effc670e381bc4046b7769299f51641 |
|
MD5 | 5cdb05cc62b0d534eb493e96cccf08de |
|
BLAKE2b-256 | 0fdece95064363ad13123232a369dac737490ce4afe4c3e5943ad2201e4787b0 |
File details
Details for the file skip_django_psycopg2_extension-0.1.1.2-py3-none-any.whl
.
File metadata
- Download URL: skip_django_psycopg2_extension-0.1.1.2-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff97403ed5251565ba53bb31d809b9fde86819b320745aac1ec46c88526c763d |
|
MD5 | 17fd50fd09b843f863d80eb60adeabb9 |
|
BLAKE2b-256 | 8639609072af3b5f957c95e8a12e7058ee554c029b0e9141c3a60987928f0a8c |