def create_table(): if not User.exists(): app.logger.debug('Creating DynamoDB User table..') User.create_table(read_capacity_units=app.config['DDB_RCU'], write_capacity_units=app.config['DDB_WCU'], wait=True) if not Photo.exists(): app.logger.debug('Creating DynamoDB Photo table..') Photo.create_table(read_capacity_units=app.config['DDB_RCU'], write_capacity_units=app.config['DDB_WCU'], wait=True)
def delete_table(): if User.exists(): User.delete_table() if Photo.exists(): Photo.delete_table()
from cloudalbum.database.model_ddb import User from flask import current_app as app if not User.exists(): User.create_table(read_capacity_units=app.config['DDB_RCU'], write_capacity_units=app.config['DDB_WCU'], wait=True) app.logger.debug('DynamoDB User table created!') def create_table(): User.create_table() app.logger.debug("Dynamodb Users table created") def delete_table(): User.delete_table() app.logger.debug("Dynamodb Users table deleted")
def test_user_table(self): """Ensure the DDB User table is available.""" self.assertEqual(User.exists(), True)