datamodelv1.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:aCloudGuru-DynamoDB 作者: acantril 项目源码 文件源码
def c_table (Table, t_config): # create dynamo DB tables
    """
    try to create table, if it errors tables exist,
    drop the tables, and then rerun the function to create again.
    """
    try:
        print "INFO :: Creating %s Table....." % Table
        db_r.create_table(
            AttributeDefinitions = t_config[Table]['AttributeDefinitions'],
            TableName=Table,
            KeySchema = t_config[Table]['KeySchema'],
            ProvisionedThroughput=t_config[Table]['ProvisionedThroughput']
        )
        print "INFO :: Waiting for completion..."
        db_r.Table(Table).wait_until_exists()
    except botocore.exceptions.ClientError as e:
        if e.response['Error']['Code'] == "ResourceInUseException":
            print "INFO :: Learning Online %s Table exists, deleting ...." % Table
            db_r.Table(Table).delete()
            print "INFO :: Waiting for delete.."
            db_r.Table(Table).wait_until_not_exists()
            c_table (Table, t_config)
        else:
            print "Unknown Error"
#------------------------------------------------------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号