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
Hashes for skip-django-psycopg2-extension-0.1.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8df57bc733be85248e44201a40315de21365594a89d0ea3ca05f9c403c6af802 |
|
MD5 | 35c7c0b24598be9640eefe82c9bd5fb6 |
|
BLAKE2b-256 | a8e6f5eada61a3e416bcabbe3e81cb74a9d81806fef587bf2f3c0ea9b6d41e4d |
Hashes for skip_django_psycopg2_extension-0.1.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea6c4dc3991f1cd2631dfc58b16119a7c9474cf3b23f1b8205be16c0f19d8b79 |
|
MD5 | 7e5c057b1f9bb927847ddc4ef51b7e25 |
|
BLAKE2b-256 | 4d24045ef76aac70364768e5f1fd63ef1f54ff2c313608e412a980277cd61e94 |