2

我在 Amazon Aurora 中有一个旧版 MySQL 数据库,我想将其与 SQLAlchemy Automap 一起使用。

我正在运行以下版本:

15:09 $ pip freeze
appnope==0.1.0
backports.shutil-get-terminal-size==1.0.0
decorator==4.0.10
enum34==1.1.6
ipython==5.1.0
ipython-genutils==0.1.0
mysql==0.0.1
MySQL-python==1.2.5
pathlib2==2.1.0
pexpect==4.2.1
pickleshare==0.7.4
prompt-toolkit==1.0.9
ptyprocess==0.5.1
Pygments==2.1.3
simplegeneric==0.8.1
six==1.10.0
SQLAlchemy==1.1.3
traitlets==4.3.1
wcwidth==0.1.7

而这段代码:

import os
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine

Base = automap_base()
cs = os.environ['SQLALCHEMY_DATABASE_URI']
engine = create_engine(cs)
Base.prepare(engine, reflect=True)

但在准备电话中,我得到以下异常:

1925         except exc.DBAPIError as e:
1926             if self._extract_error_code(e.orig) == 1146:
-> 1927                 raise exc.NoSuchTableError(full_name)
1928             else:
1929                 raise

NoSuchTableError: `role`

是否有 SQLAlchemy 驱动程序可以解释 Aurora 中的差异,或者这是否表明架构存在真正的问题?

4

0 回答 0