2015-11-15 08:10:46 +00:00
|
|
|
from ogn.model import Base
|
|
|
|
|
|
|
|
from manager import Manager
|
|
|
|
manager = Manager()
|
|
|
|
|
|
|
|
from ogn.collect.fetchddb import update_ddb_data
|
|
|
|
|
2015-11-15 18:31:58 +00:00
|
|
|
|
2015-11-15 08:10:46 +00:00
|
|
|
@manager.command
|
|
|
|
def init():
|
|
|
|
"""Initialize the database."""
|
2015-11-15 09:31:35 +00:00
|
|
|
from ogn.commands.dbutils import engine
|
2015-11-15 08:10:46 +00:00
|
|
|
Base.metadata.create_all(engine)
|
|
|
|
print("Done.")
|
2015-11-15 08:23:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
@manager.command
|
|
|
|
def updateddb():
|
|
|
|
"""Update the ddb data."""
|
|
|
|
print("Updating ddb data...")
|
|
|
|
result = update_ddb_data.delay()
|
|
|
|
counter = result.get()
|
2015-11-15 11:10:20 +00:00
|
|
|
print("Imported %i devices." % counter)
|