当代数据库管理系统课程实验二
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

21 rinda
648 B

  1. from flask import Blueprint
  2. from flask import Flask, abort, request, jsonify
  3. import json
  4. from flask import jsonify
  5. from be.model import postgreSQLORM
  6. from be.model.postgreSQLORM import User,Store_Book,User_Store,New_Order,New_Order_Detail
  7. bp_testconn = Blueprint("testconn",__name__,url_prefix="/testconn")
  8. @bp_testconn.route("/test",methods=['GET'])
  9. def test():
  10. user_id: str = request.args.get("user_id")
  11. print(user_id)
  12. try:
  13. ss = postgreSQLORM.session.query(User).filter(User.user_id==user_id).all()
  14. for i in ss:
  15. print('user_id',i.user_id)
  16. except:
  17. print("error")
  18. return "connect success"