2015-11-15 08:10:46 +00:00
|
|
|
from ogn.model import Base
|
2015-11-29 20:51:23 +00:00
|
|
|
from ogn.collect.fetchddb import update_ddb_from_ogn, update_ddb_from_file
|
|
|
|
from ogn.commands.dbutils import engine
|
2015-11-15 08:10:46 +00:00
|
|
|
|
|
|
|
from manager import Manager
|
|
|
|
manager = Manager()
|
|
|
|
|
2015-11-15 18:31:58 +00:00
|
|
|
|
2015-11-15 08:10:46 +00:00
|
|
|
@manager.command
|
|
|
|
def init():
|
|
|
|
"""Initialize the database."""
|
|
|
|
Base.metadata.create_all(engine)
|
|
|
|
print("Done.")
|
2015-11-15 08:23:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
@manager.command
|
2015-11-24 07:20:28 +00:00
|
|
|
def update_ddb_ogn():
|
|
|
|
"""Update devices with data from ogn."""
|
2015-11-15 08:23:57 +00:00
|
|
|
print("Updating ddb data...")
|
2015-11-24 07:20:28 +00:00
|
|
|
result = update_ddb_from_ogn.delay()
|
|
|
|
counter = result.get()
|
|
|
|
print("Imported %i devices." % counter)
|
|
|
|
|
|
|
|
|
|
|
|
@manager.command
|
|
|
|
def update_ddb_file():
|
|
|
|
"""Update devices with data from local file."""
|
|
|
|
print("Updating ddb data...")
|
|
|
|
result = update_ddb_from_file.delay()
|
2015-11-15 08:23:57 +00:00
|
|
|
counter = result.get()
|
2015-11-15 11:10:20 +00:00
|
|
|
print("Imported %i devices." % counter)
|