Fix error on startup caused by incorrect types and new SqlAlchemy.
This commit is contained in:
parent
ccba50e2cf
commit
152787f6d6
@ -5,7 +5,7 @@ from typing import Dict, Any, Optional
|
||||
from bemani.common import Time
|
||||
|
||||
from sqlalchemy.engine.base import Connection # type: ignore
|
||||
from sqlalchemy.engine.result import ResultProxy # type: ignore
|
||||
from sqlalchemy.engine import CursorResult # type: ignore
|
||||
from sqlalchemy.sql import text # type: ignore
|
||||
from sqlalchemy.types import String, Integer # type: ignore
|
||||
from sqlalchemy import Table, Column, MetaData # type: ignore
|
||||
@ -54,7 +54,7 @@ class BaseData:
|
||||
self.__config = config
|
||||
self.__conn = conn
|
||||
|
||||
def execute(self, sql: str, params: Optional[Dict[str, Any]]=None, safe_write_operation: bool=False) -> ResultProxy:
|
||||
def execute(self, sql: str, params: Optional[Dict[str, Any]]=None, safe_write_operation: bool=False) -> CursorResult:
|
||||
"""
|
||||
Given a SQL string and some parameters, execute the query and return the result.
|
||||
|
||||
@ -63,7 +63,7 @@ class BaseData:
|
||||
params - Dictionary of parameters which will be substituted into the sql string.
|
||||
|
||||
Returns:
|
||||
A SQLAlchemy ResultProxy object.
|
||||
A SQLAlchemy CursorResult object.
|
||||
"""
|
||||
if self.__config['database'].get('read_only', False):
|
||||
# See if this is an insert/update/delete
|
||||
|
@ -1,8 +1,7 @@
|
||||
import datetime
|
||||
from typing import Dict, Any
|
||||
from flask import Blueprint, request, redirect, Response, url_for, make_response, render_template, g # type: ignore
|
||||
|
||||
from bemani.common import CardCipher, CardCipherException, AESCipher
|
||||
from bemani.common import CardCipher, CardCipherException, AESCipher, Time
|
||||
from bemani.frontend.app import loginrequired, loginprohibited, success, error, jsonify, valid_email, valid_username, valid_pin, render_react
|
||||
from bemani.frontend.templates import templates_location
|
||||
from bemani.frontend.static import static_location
|
||||
@ -33,7 +32,7 @@ def login() -> Response:
|
||||
response.set_cookie(
|
||||
'SessionID',
|
||||
aes.encrypt(sessionID),
|
||||
expires=datetime.datetime.now() + datetime.timedelta(days=90)
|
||||
expires=Time.now() + (90 * Time.SECONDS_IN_DAY),
|
||||
)
|
||||
return response
|
||||
else:
|
||||
|
@ -12,7 +12,7 @@ import struct
|
||||
import yaml # type: ignore
|
||||
import xml.etree.ElementTree as ET
|
||||
from sqlalchemy import create_engine # type: ignore
|
||||
from sqlalchemy.engine.result import ResultProxy # type: ignore
|
||||
from sqlalchemy.engine import CursorResult # type: ignore
|
||||
from sqlalchemy.orm import sessionmaker # type: ignore
|
||||
from sqlalchemy.sql import text # type: ignore
|
||||
from sqlalchemy.exc import IntegrityError # type: ignore
|
||||
@ -75,7 +75,7 @@ class ImportBase:
|
||||
self.__session.commit()
|
||||
self.__batch = False
|
||||
|
||||
def execute(self, sql: str, params: Optional[Dict[str, Any]]=None) -> ResultProxy:
|
||||
def execute(self, sql: str, params: Optional[Dict[str, Any]]=None) -> CursorResult:
|
||||
if not self.__batch:
|
||||
raise Exception('Logic error, cannot execute outside of a batch!')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user