当前位置:网站首页>已解决(sqlalchemy+pandas.read_sql)AttributeError: ‘Engine‘ object has no attribute ‘execution_options‘
已解决(sqlalchemy+pandas.read_sql)AttributeError: ‘Engine‘ object has no attribute ‘execution_options‘
2022-07-05 03:36:00 【无 羡ღ】
成功解决( python3+sqlalchemy+pymysql 的 pandas read_sql() 方法从 MySQL 查询中读取数据报错)AttributeError: ‘Engine‘ object has no attribute ‘execution_options‘
报错代码
我的代码:
import pandas
import sqlalchemy
engine = sqlalchemy.create_engine('mssql+pymssql://用户名:密码@地址:端口号/表名')
sql = "select max(rid) as maxrid FROM student "
df = pandas.read_sql(sql=sql, con=engine)
print(df)
报错信息:
return self.connectable.execution_options().execute(*args, **kwargs)
AttributeError: 'Engine' object has no attribute 'execution_options'

报错原因
报错内容翻译:
AttributeError:“引擎”对象没有属性“execution\u options”
解决方法
传递“连接”变量而不是“引擎”
import pandas
import sqlalchemy
engine = sqlalchemy.create_engine('mssql+pymssql://用户名:密码@地址:端口号/表名')
sql = "select max(rid) as maxrid FROM student "
connection = engine.connect()
df = pandas.read_sql(sql=sql, con=connection)
print(df)
运行成功:
maxrid
0 15159049
边栏推荐
- Subversive cognition: what does SRE do?
- Is there any way to change the height of the uinavigationbar in the storyboard without using the UINavigationController?
- An elegant program for Euclid‘s algorithm
- [untitled]
- [deep learning] deep learning reference materials
- Kubernetes - identity and authority authentication
- Web components series (VII) -- life cycle of custom components
- UE4 DMX和grandMA2 onPC 3.1.2.5的操作流程
- 花了2晚,拿到了吴恩达@斯坦福大学的机器学习课程证书
- Leetcode92. reverse linked list II
猜你喜欢
![[数组]566. 重塑矩阵-简单](/img/3c/593156f5bde67bd56828106d7bed3c.png)
[数组]566. 重塑矩阵-简单

UI自动化测试从此告别手动下载浏览器驱动

Share the newly released web application development framework based on blazor Technology
![[vérification sur le Web - divulgation du code source] obtenir la méthode du code source et utiliser des outils](/img/ea/84e67a1fca0e12cc4452c744c242b4.png)
[vérification sur le Web - divulgation du code source] obtenir la méthode du code source et utiliser des outils

ActiveReportsJS 3.1 VS ActiveReportsJS 3.0

A brief introduction to the behavior tree of unity AI

UE4 DMX和grandMA2 onPC 3.1.2.5的操作流程

Clickhouse物化视图

How to learn to get the embedding matrix e # yyds dry goods inventory #
![[luat-air105] 4.1 file system FS](/img/5e/7fdeedaef420736d761f4a681cd2d8.jpg)
[luat-air105] 4.1 file system FS
随机推荐
程序员的视力怎么样? | 每日趣闻
JWT漏洞复现
Is there any way to change the height of the uinavigationbar in the storyboard without using the UINavigationController?
Kubernetes - Multi cluster management
Some enterprise interview questions of unity interview
[groovy] groovy environment setup (download groovy | install groovy | configure groovy environment variables)
NPM introduction link symbolic link
KVM virtualization
企业级:Spire.Office for .NET:Platinum|7.7.x
Redis source code analysis: redis cluster
一文带你了解BI的前世今身与企业数字化转型的关系
When sqlacodegen generates a model, how to solve the problem that the password contains special characters?
postman和postman interceptor的安装
DMX parameter exploration of grandma2 onpc 3.1.2.5
[learning notes] month end operation -gr/ir reorganization
Analysis of dagger2 principle
【软件逆向-分析工具】反汇编和反编译工具
【web审计-源码泄露】获取源码方法,利用工具
UI自动化测试从此告别手动下载浏览器驱动
有個疑問 flink sql cdc 的話可以設置並行度麼, 並行度大於1會有順序問題吧?