sqlalchemy.exc.InvalidRequestError:无效的database.table字符串,

时间:2019-06-24 19:39:04

标签: python sqlalchemy

我无法访问具有以下架构的Microsoft SQL Server表。我已经导入了正确的SQL连接包,并且具有用于数据库连接的正确URL。通过执行选择查询,我已经在数据库中包含了哪些相关表

<==
SELECT
  *
FROM
  INFORMATION_SCHEMA.TABLES;
GO

==>
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      TABLE_TYPE
DVMTSP30_ver1   SP              AllowedSystems  BASE TABLE

相关的python代码:

#IMPORTS
from sqlalchemy.ext.automap import automap_base
from sqlalchemy import MetaData, Table

#create SQL engine

def get_all_allowed_systems(app,engine):
    url= 'mssql+pymssql://appdbowner:***@bleh.domain.local:1515/DVMTSP30_ver1'
    engine = create_engine(url)
    metadata = MetaData()
    metadata.reflect(engine, only= ['AllowedSystems'])
    Base = automap_base(metadata=metadata)
    Base.prepare()

错误:

sqlalchemy.exc.InvalidRequestError: Could not reflect: requested table(s) not available in Engine(mssql+pymssql://appdbowner:***@bleh.domain.local:1515/DVMTSP30_ver1): (SP.AllowedSystems)

0 个答案:

没有答案