1234567891011121314151617181920 |
- from flask import Flask, request, jsonify
- from flask_sqlalchemy import sqlalchemy
- from flask_marshmallow import Marshmallow
- from sqlalchemy import create_engine
- import pymysql
- import secrets
-
-
- #initialize api
- conn = 'mysql://{0}:{1}@{2}:{3}/{4}'.format(secrets.dbuser, secrets.dbpassword, secrets.dbhost, secrets.dbport ,secrets.dbname)
-
- engine = create_engine(conn)
- connection = engine.connect()
-
- query = "Select * tablename"
- results = connection.execute(query)
-
-
- if __name__ == '__main__':
- app.run(debug=True)
|