A pluggable Django app for the EVE SDE
Project description
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.
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 armada-sde-0.3.0.tar.gz
.
File metadata
- Download URL: armada-sde-0.3.0.tar.gz
- Upload date:
- Size: 22.4 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 717138d62a7b1e57f36361ad9111b8fe3f9ea09f185ffcf20a87cc6127f4b971 |
|
MD5 | 12db7d435b9201168c5a2728b55ad4fb |
|
BLAKE2b-256 | a2a8e69120994b2ddc2507d078ffde6f30242a6ad2c49a1a33ba6e4c6f132f1e |
File details
Details for the file armada_sde-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: armada_sde-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 2, Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c55e9eb7d42a39ebfa04c2c4bc6e25eaa59ae5348269109c1e3ffa362b080a1e |
|
MD5 | 1dd0c6a6f5557cf7ff200d53183dbf4a |
|
BLAKE2b-256 | 2fe2ae00a443d2ba0393c47620b315be134c6f1fc5305a7f35254ad2e4be8e80 |