Django-psycopg2-extension
Library contains django commands which helps to prepare and manage PostgreSQL database.
Quickstart
Install djjango-psycopg2-extension
pip install 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.
psqlviews
Command which creates views defined in 'VIEWS' setting.
DATABASES = {
'default': {
...
'VIEWS': {
'MODELS': {
'auth.users': ['id', 'email', 'first_name', 'last_name'], # Model name and list of fields
},
'SCHEMA': 'public', # Schema name
}
}
}
Now you can call psqlviews command to create or remove views.
./manage.py psqlviews --create
./manage.py psqlviews --delete
Metadata
Release files for django-psycopg2-extension 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-psycopg2-extension-0.2.1.tar.gz | 7.2 kB | Without provenance | Details |
Release files / django-psycopg2-extension-0.2.1.tar.gz
| Download URL | django-psycopg2-extension-0.2.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a17bf1743f537c458233777899da740770b7e5d337681459795d4bd2959c643
|
|
BLAKE2b-256 checksum How to use checksums |
3046a3d86d1a3fa738065ee13ff4a70e6d797b7ad3b439768c80a6458e1f3813
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.28.1 setuptools/68.1.2 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.10
|
Security for django-psycopg2-extension 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.