from fuware.core.security import get_hasher hasher = get_hasher() INITIAL_DATA = { 'users': [ { 'username': 'sam', 'password': hasher.hash('admin'), 'name': 'Sam', 'is_admin': 1, 'is_lock': 0, }, { 'username': 'sam1', 'password': hasher.hash('admin'), 'name': 'Sam1', 'is_admin': 0, 'is_lock': 1 }, ] } # This method receives a table, a connection and inserts data to that table. def initialize_table(target, connection, **kwargs): tablename = str(target) if tablename in INITIAL_DATA and len(INITIAL_DATA[tablename]) > 0: connection.execute(target.insert(), INITIAL_DATA[tablename])