nk20-scripts/management/commands/import_nk15.py

34 lines
943 B
Python
Raw Normal View History

2020-02-24 13:19:40 +00:00
#!/usr/env/bin python3
2020-05-24 23:18:24 +00:00
import subprocess
from django.core.management.base import BaseCommand
from django.core.management import call_command
2020-04-27 00:08:01 +00:00
2020-07-21 23:28:28 +00:00
from ._import_utils import ImportCommand
class Command(ImportCommand):
2020-02-24 13:19:40 +00:00
"""
Command for importing the database of NK15.
Need to be run by a user with a registered role in postgres for the database nk15.
"""
2020-02-24 13:19:40 +00:00
def handle(self, *args, **kwargs):
2020-05-24 23:18:24 +00:00
subprocess.call("./apps/scripts/shell/tabularasa")
2020-07-21 23:28:28 +00:00
kwargs["alias"] = True
kwargs["chunk"] = 1000
kwargs["save"] = "map.json"
call_command('import_account', **kwargs)
del kwargs["alias"]
del kwargs["save"]
kwargs["chunk"] = 100
kwargs["map"] = "map.json"
call_command('import_activities', **kwargs)
kwargs["chunk"] = 10000
kwargs["map"] = "map.json"
kwargs["buttons"] = True
call_command('import_transaction', **kwargs)
2020-05-24 23:18:24 +00:00
#