如何从flask-SQLAlchemy对象创建引擎?

时间:2017-06-11 22:32:01

标签: flask sqlalchemy flask-sqlalchemy

我有以下代码:

from flask import Flask, request, session, g, redirect, url_for, abort, \
 render_template, flash
import pypyodbc
import pdb
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)

app.config['SQLALCHEMY_DATABASE_URI'] = 'mssql+pypyodbc://SERVERNAME/DB'
db = SQLAlchemy(app)

@app.route('/')
def main():

    result = db.engine.execute('SELECT * from Table')

    return render_template('index.html')

这会导致以下错误:

ImportError: DLL load failed: The specified procedure could not be found.

我在文档中找不到这样的例子......使用SQLAlchemy对象引擎的正确方法是什么?

谢谢!

0 个答案:

没有答案