More fixes for linux
This commit is contained in:
parent
007fb2c9e1
commit
465a534317
2 changed files with 17 additions and 15 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from aiohttp import web
|
||||
import aiohttp_security
|
||||
import datetime
|
||||
import aiomysql
|
||||
|
||||
import security
|
||||
|
||||
|
|
@ -16,9 +17,10 @@ def datetime_format(postdata):
|
|||
|
||||
def init_app(app):
|
||||
async def db_query(query, params=()):
|
||||
await app['cur'].execute(query, params)
|
||||
q = app['cur'].mogrify(query, params)
|
||||
r = await app['cur'].fetchall()
|
||||
cursor = await app['con'].cursor(aiomysql.DictCursor)
|
||||
await cursor.execute(query, params)
|
||||
q = cursor.mogrify(query, params)
|
||||
r = await cursor.fetchall()
|
||||
result = [{k: (str(v) if isinstance(v, datetime.date) or isinstance(v, datetime.timedelta) else v) for k, v in row.items()} for row in r]
|
||||
return (q, result)
|
||||
|
||||
|
|
|
|||
|
|
@ -209,21 +209,21 @@ async def pivot_table(cursor, options):
|
|||
'none' : ("", "", ""),
|
||||
'month' : ("CONCAT(YEAR(O.OrderDate), '-', LPAD(MONTH(O.OrderDate), 2, '0')) AS month", "month", ""),
|
||||
'year' : ("YEAR(O.OrderDate) AS year", "year", ""),
|
||||
'employee': ("CONCAT(E.firstname, ' ', E.lastname) AS employeename",
|
||||
'employee': ("CONCAT(E.FirstName, ' ', E.LastName) AS employeename",
|
||||
"employeename",
|
||||
"LEFT JOIN employees AS E ON O.employeeid = E.employeeid"),
|
||||
'shipper' : ("SH.shippername",
|
||||
"SH.shippername",
|
||||
"LEFT JOIN shippers AS SH ON O.shipperid = SH.shipperid"),
|
||||
"LEFT JOIN Employees AS E ON O.EmployeeID = E.EmployeeID"),
|
||||
'shipper' : ("SH.ShipperName",
|
||||
"SH.ShipperName",
|
||||
"LEFT JOIN Shippers AS SH ON O.ShipperID = SH.ShipperID"),
|
||||
'customer': ("C.CustomerName",
|
||||
"C.CustomerName",
|
||||
"LEFT JOIN customers AS C ON O.CustomerID = C.CustomerID"),
|
||||
'supplier': ("S.suppliername",
|
||||
"S.suppliername",
|
||||
"LEFT JOIN suppliers AS S ON P.SupplierID = S.SupplierID"),
|
||||
'category': ("CA.categoryname",
|
||||
"CA.categoryname",
|
||||
"LEFT JOIN categories AS CA ON P.CategoryID = CA.CategoryID"),
|
||||
"LEFT JOIN Customers AS C ON O.CustomerID = C.CustomerID"),
|
||||
'supplier': ("S.SupplierName",
|
||||
"S.SupplierName",
|
||||
"LEFT JOIN Suppliers AS S ON P.SupplierID = S.SupplierID"),
|
||||
'category': ("CA.CategoryName",
|
||||
"CA.CategoryName",
|
||||
"LEFT JOIN Categories AS CA ON P.CategoryID = CA.CategoryID"),
|
||||
'product' : ("P.ProductName", "P.ProductName", "")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue