def parse(): conn, cursor = models.init() global mydata req = request.args if "company" in req: company_code = req["company"] mydata = models.execute(conn, cursor, ("company", company_code)) elif "person" in req: name = req["person"] mydata = models.execute(conn, cursor, ("person", name)) return render_template('test.html')
def mlogin(): if request.method == 'POST': session.pop('user', None) cemail = request.form['lemail'] cpassword = request.form['lpassword'] result_p = execute(cemail) passw = [row[0] for row in result_p] if cpassword == passw[0]: session['user'] = request.form['lemail'] return jsonify(result="LOGIN SUCCESSFUL") #redirect('/sdata') else: return jsonify(result="PLEASE CHECK YOUR EMAIL ID OR PASSWORD") #render_template('mainlogin.html') else: return jsonify(error="CHECK YOUR SENDING METHOD")
import models from tms_script import script # Function 1 # create DB tables print('\n') print("Creating database tables...") models.execute() print('Done!') print('\n') # update sql_mode print('\n') print("Updating SQL mode...") models.sql_mode() print('Done!') print('\n')
def insert(cls, form): # execute(cls.__table__.insert(), form) # 好像, 因为 id 没有给, 会导致 sql 执行错误. execute(cls.__table__.insert().values(form))
def init_plan_db(): log(f'验证是否出错.') query = '''DELETE FROM plans;''' execute(query) log(f'清空 plan db.')
import services if __name__ == '__main__': # 计算pre级operator utils.apply_on_factors(operators.execute, [ 'pre_risk_free_rate.PreRiskFreeRate', 'pre_capital.PreCapital', 'pre_universe.PreUniverse' ]) # 计算operator utils.apply_on_factors(operators.execute, [ 'barra_size_operator.BarraSizeOperator', 'barra_beta_operator.BarraBetaOperator', 'barra_momentum_operator.BarraMomentumOperator', 'barra_book_to_price_operator.BarraBookToPriceOperator', 'barra_liquidity_operator.BarraLiquidityOperator', 'barra_non_linear_size_operator.BarraNonLinearSizeOperator', 'barra_earnings_yield_operator.BarraEarningsYieldOperator', 'barra_growth_operator.BarraGrowthOperator', 'barra_leverage_operator.BarraLeverageOperator', 'barra_residual_volatility_operator.BarraResidualVolatilityOperator' ]) # 计算post级operator operators.execute('post_barra_factors_stand.PostBarraFactorsStand') # 计算model models.execute('barra_cne5_model.BarraCNE5Model') # 计算service services.execute('barra_cne5_service.BarraCNE5RetService')
def update_db(cls): log('to test.') ct_ = today_text() log(f'更新数据库 mark_plan: (id_, {ct_}, ).') d_ = {'ct': ct_} execute(cls.__table__.update(), d_)