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


Python Query.query方法代码示例

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


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

示例1: exist

# 需要导入模块: from query import Query [as 别名]
# 或者: from query.Query import query [as 别名]
def exist(cls, where=None, uuid=None):
    where = where or {}
    if uuid:
        where['uuid'] = uuid

    q = Query(cls).select(["count(*)"]).where(where).limit(1)
    sql, where = q.query()
    connection.my_connection().execute(sql, where)
    results = connection.my_connection().fetchall()
    return results[0][0] > 0
开发者ID:felipevolpone,项目名称:alabama_orm,代码行数:12,代码来源:storage.py

示例2: save

# 需要导入模块: from query import Query [as 别名]
# 或者: from query.Query import query [as 别名]
 def save(self):
   # If it doesn't have an ID (Either nonexistant or not set), then call the
   # create() method to do an INSERT instead of an UPDATE.
   try:
     if not self.id: self.create()
   except AttributeError: self.create()
   base = 'UPDATE %s SET ' % self.Table
   diff = self.diff()
   fields = ''
   if not diff: return None
   # Build field and value list if there is a difference
   for key in diff:
     field = self._get_field_by_name(key)
     value = field.query(diff[key])
     fields += ', ' + field.name + ' = ' + Query.format_type(value)
   base += fields[2:] + ' WHERE id = ' + str(self.id)
   Query.query(base)
   # Right now, just spit back the instance of self
   return self
开发者ID:dirk,项目名称:constrictor,代码行数:21,代码来源:model.py


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