armada-sde
armada-sde is a pluggable app for Django which provides models and tools for using Fuzzysteve's PostgreSQL dumps. Its design allows you to automate upgrades of the SDE data and generate new models for any tables contained therein.
Usage
Grab the latest version of armada-sde directly from PyPI:
pip install armada-sde
Add it to Django's settings.py:
INSTALLED_APPS = [
# ...
'armada_sde',
]
Download Fuzzysteve's latest schema dump for postgres and unpack:
wget https://www.fuzzwork.co.uk/dump/postgres-schema-latest.dmp.bz2
bunzip2 postgres-schema-latest.dmp.bz2
Import the dump
python manage.py pg_import_sde -f postgres-schema-latest.dmp
If you want to handle the importing yourself, run pg_import_sde with -s and no -f. This will rename the tables,
so to better fit with Django best practices.
After import, the tables needs to be moved from the evesde schema to the public schema:
python manage.py pg_move_sde
You should now be able to import models and use them:
from django.db import models
from armada_sde.models import InvType
# Trit for the trit god
trit = InvType.objects.get(name='Tritanium')
# Use it in your models
class ShoppingListItem(models.Model):
quantity = models.IntegerField(default=1)
item = models.ForeignKey(InvType, on_delete=models.DO_NOTHING)
Advanced usage
Generate models
armada_sde comes with a stock set of models which is generated automatically through a customized version of Django's inspectdb command. You can generate your own set of models and do your own alterations, if you like. First, import the dump as previously described, so it is present in the evesde schema. Then you can generate a models file:
python manage.py pg_generate_models -o project/myapp/models.py
After generation, move the tables into the public schema and generate primary keys, with the pg_move_sde command.
You can now do any alterations you like. If you would like to generate migrations for your models, remove
managed = False from the Meta class.
If you want, you can also ensure compatibility with other pluggable apps that use the SDE models, by configuring
armada_sde to load your custom variants instead of the stock models. Add this to your settings.py:
ARMADA = {
'SDE': {
'module': 'project.myapp.models'
}
}
Any other app importing models from armada_sde.models, will instead be loading your custom models from your project.
Using a custom schema for the SDE
If you are sharing a database between several projects, it might be handy to have a shared schema for the SDE. You can configure armada-sde to use a custom destination schema for tables, instead of moving them from evesde into public.
To achieve this, set these parameters in settings.py:
ARMADA = {
'SDE': {
'schema': '<your_sde_schema>'
}
}
It is not a good idea to use the evesde schema as your custom schema, as it might give you issues when upgrading the SDE.
Metadata
Release files for armada-sde 0.3.0
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 | Actions |
|---|---|---|---|---|
| armada-sde-0.3.0.tar.gz | 22.4 kB | Without provenance | Details for armada-sde-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| armada_sde-0.3.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for armada_sde-0.3.0-py2.py3-none-any.whl |
Total release size: 50.9 kB
Release files / armada-sde-0.3.0.tar.gz
| Download URL | armada-sde-0.3.0.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
717138d62a7b1e57f36361ad9111b8fe3f9ea09f185ffcf20a87cc6127f4b971
|
|
BLAKE2b-256 checksum How to use checksums |
a2a8e69120994b2ddc2507d078ffde6f30242a6ad2c49a1a33ba6e4c6f132f1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.2
|
Release files / armada_sde-0.3.0-py2.py3-none-any.whl
| Download URL | armada_sde-0.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 28.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c55e9eb7d42a39ebfa04c2c4bc6e25eaa59ae5348269109c1e3ffa362b080a1e
|
|
BLAKE2b-256 checksum How to use checksums |
2fe2ae00a443d2ba0393c47620b315be134c6f1fc5305a7f35254ad2e4be8e80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.2
|
Security for armada-sde 0.3.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.