###haskell 基本类型,bool(True/False),list[],tuple(),int,Integer,Double,char'' ,string"",function(\x->x+1)
- wiki
import asyncio | |
import aiomysql | |
from aiomysql.cursors import DictCursor | |
class MysqlWrapper: | |
def __init__(self, host, port, user, password, db): | |
self.host = host | |
self.port = port |
def get_count(q): | |
count_q = q.statement.with_only_columns([func.count()]).order_by(None) | |
count = q.session.execute(count_q).scalar() | |
return count | |
q = session.query(TestModel).filter(...).order_by(...) | |
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ... | |
print q.count() |