Exemple #1
0
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)
Exemple #2
0
def delete_table():
    if User.exists():
        User.delete_table()
    if Photo.exists():
        Photo.delete_table()
from cloudalbum.database.model_ddb import User, Photo
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!')

if not Photo.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()
    Photo.create_table()
    app.logger.debug("Dynamodb Users & Photos table created")


def delete_table():
    User.delete_table()
    Photo.delete_table()
    app.logger.debug("Dynamodb Users & Photos table deleted")
def delete_table():
    ### User table is no longer needed
    # if User.exists():
    #     User.delete_table()
    if Photo.exists():
        Photo.delete_table()
 def test_photo_table(self):
     """Ensure the DDB Photo table is available."""
     self.assertEqual(Photo.exists(), True)