当前位置: 首页>>代码示例>>Python>>正文


Python SDBConnection.lookup方法代码示例

本文整理汇总了Python中boto.sdb.connection.SDBConnection.lookup方法的典型用法代码示例。如果您正苦于以下问题:Python SDBConnection.lookup方法的具体用法?Python SDBConnection.lookup怎么用?Python SDBConnection.lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boto.sdb.connection.SDBConnection的用法示例。


在下文中一共展示了SDBConnection.lookup方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_latest_snapshot

# 需要导入模块: from boto.sdb.connection import SDBConnection [as 别名]
# 或者: from boto.sdb.connection.SDBConnection import lookup [as 别名]
def get_latest_snapshot(key, access, name):
	sdb = SDBConnection(key, access, region=region_info)

	domain = sdb.lookup(name, True)
	if domain == None:
		domain = sdb.create_domain(name)

	return domain.get_item('snapshot', True)['snapshot']
开发者ID:numan,项目名称:solrDs,代码行数:10,代码来源:administration.py

示例2: delete_snapshot

# 需要导入模块: from boto.sdb.connection import SDBConnection [as 别名]
# 或者: from boto.sdb.connection.SDBConnection import lookup [as 别名]
def delete_snapshot(key, access, name, snapshot_id):
	sdb = SDBConnection(key, access, region=region_info)

	domain = sdb.lookup(name, True)
	if domain == None:
		domain = sdb.create_domain(name)

	return domain.delete_item(domain.get_item(snapshot_id))
开发者ID:numan,项目名称:solrDs,代码行数:10,代码来源:administration.py

示例3: get_all_snapshots

# 需要导入模块: from boto.sdb.connection import SDBConnection [as 别名]
# 或者: from boto.sdb.connection.SDBConnection import lookup [as 别名]
def get_all_snapshots(key, access, name):
	sdb = SDBConnection(key, access, region=region_info)

	domain = sdb.lookup(name, True)
	if domain == None:
		domain = sdb.create_domain(name)

	now = strftime("%Y-%m-%d %H:%M:%S", gmtime())
	select = "select * from `{0}` where itemName() > 'snap-' and itemName() != 'snapshot'".format(name)
	snapshots = domain.select(select, consistent_read=True)
	return snapshots
开发者ID:numan,项目名称:solrDs,代码行数:13,代码来源:administration.py

示例4: SDB

# 需要导入模块: from boto.sdb.connection import SDBConnection [as 别名]
# 或者: from boto.sdb.connection.SDBConnection import lookup [as 别名]
def SDB(domain_name):
    """
    Create connection to SimpleDB and return the specifed domain.
    
    domain_name - the SimpleDB domain you wish to return
    """
    conn = SDBConnection(ACCESS_KEY_ID,SECRET_ACCESS_KEY)
    domain = conn.lookup(domain_name)
    if not domain:
        domain = conn.create_domain(domain_name)
    return domain
开发者ID:mumrah,项目名称:ec2mpi,代码行数:13,代码来源:main.py

示例5: get_expired_snapshots

# 需要导入模块: from boto.sdb.connection import SDBConnection [as 别名]
# 或者: from boto.sdb.connection.SDBConnection import lookup [as 别名]
def get_expired_snapshots(key, access, cluster):
    sdb = SDBConnection(key, access, region=region_info)

    domain = sdb.lookup(cluster, True)
    if domain == None:
        domain = sdb.create_domain(cluster)

    now = strftime("%Y-%m-%d %H:%M:%S", gmtime())
    select = "select * from `{0}` where itemName() > 'snap-' and itemName() != 'snapshot' and expires < '{1}'".format(
        cluster, now
    )
    snapshots = domain.select(select, consistent_read=True)
    return snapshots
开发者ID:numan,项目名称:pgRDS,代码行数:15,代码来源:administration.py

示例6: add_snapshot

# 需要导入模块: from boto.sdb.connection import SDBConnection [as 别名]
# 或者: from boto.sdb.connection.SDBConnection import lookup [as 别名]
def add_snapshot(key, access, cluster, name, snapshot):
    sdb = SDBConnection(key, access, region=region_info)

    domain = sdb.lookup(cluster, True)
    if domain == None:
        domain = sdb.create_domain(cluster)

    now = strftime("%Y-%m-%d %H:%M:%S", gmtime())

    # add the snapshot for expiration
    backup = domain.new_item(snapshot[0])
    backup.add_value("name", name)
    backup.add_value("snapshot", snapshot[0])
    backup.add_value("created", now)
    backup.add_value("expires", snapshot[1])
    backup.save()
开发者ID:numan,项目名称:pgRDS,代码行数:18,代码来源:administration.py

示例7: get_latest_snapshot

# 需要导入模块: from boto.sdb.connection import SDBConnection [as 别名]
# 或者: from boto.sdb.connection.SDBConnection import lookup [as 别名]
def get_latest_snapshot(key, access, cluster, name):
    sdb = SDBConnection(key, access, region=region_info)
    now = strftime("%Y-%m-%d %H:%M:%S", gmtime())

    domain = sdb.lookup(cluster, True)
    if domain == None:
        domain = sdb.create_domain(cluster)

    select = "select * from `{0}` where name = '{1}' and created < '{2}' order by created desc limit 1".format(
        cluster, name, now
    )
    snapshots = domain.select(select, consistent_read=True)

    try:
        snapshot = snapshots.next()
        return snapshot["snapshot"]
    except:
        return None
开发者ID:numan,项目名称:pgRDS,代码行数:20,代码来源:administration.py

示例8: add_snapshot

# 需要导入模块: from boto.sdb.connection import SDBConnection [as 别名]
# 或者: from boto.sdb.connection.SDBConnection import lookup [as 别名]
def add_snapshot(key, access, name, snapshot):
	sdb = SDBConnection(key, access, region=region_info)

	domain = sdb.lookup(name, True)
	if domain == None:
		domain = sdb.create_domain(name)

	now = strftime("%Y-%m-%d %H:%M:%S", gmtime())

	# add the snapshot for expiration
	backup = domain.new_item(snapshot[0])
	backup.add_value('snapshot', snapshot[0])
	backup.add_value('created', now)
	backup.add_value('expires', snapshot[1])
	backup.save()

	# add the latest (for automatic restores)
	latest = domain.new_item('snapshot')
	latest.add_value('snapshot', snapshot[0])
	latest.save()
开发者ID:numan,项目名称:solrDs,代码行数:22,代码来源:administration.py


注:本文中的boto.sdb.connection.SDBConnection.lookup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。