本文整理汇总了Python中api_li3ds.database.Database.notices方法的典型用法代码示例。如果您正苦于以下问题:Python Database.notices方法的具体用法?Python Database.notices怎么用?Python Database.notices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api_li3ds.database.Database
的用法示例。
在下文中一共展示了Database.notices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from api_li3ds.database import Database [as 别名]
# 或者: from api_li3ds.database.Database import notices [as 别名]
def post(self):
'''
Create a foreign server
'''
drivers = Database.notices(multicorn_drivers_sql)[-1]
drivers = drivers.strip('NOTICE: \n').split(',')
if api.payload['driver'] not in drivers:
return abort(
400,
'{} driver does not exist, available drivers are {}'
.format(api.payload['driver'], drivers))
options = api.payload['options']
options.update(wrapper=api.payload['driver'])
options = {k: str(v) for k, v in options.items()}
options_sql = sql.SQL(', ').join([
sql.SQL(' ').join((sql.Identifier(opt), sql.Placeholder(opt)))
for opt in options
])
req = sql.SQL("""
create server {name} foreign data wrapper multicorn options (
{options}
);
""").format(name=sql.Identifier(api.payload['name']), options=options_sql)
Database.rowcount(req, options)
req = servers_sql + ' where srvname = %(name)s'
return Database.query_asjson(req, api.payload), 201
示例2: get
# 需要导入模块: from api_li3ds.database import Database [as 别名]
# 或者: from api_li3ds.database.Database import notices [as 别名]
def get(self):
'''
Retrieve driver list (multicorn based wrappers)
'''
drivers = Database.notices(multicorn_drivers_sql)[-1]
return drivers.strip('NOTICE: \n').split(',')