当前位置:网站首页>已解决(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
边栏推荐
- Unity implements the code of the attacked white flash (including shader)
- [groovy] string (string injection function | asBoolean | execute | minus)
- Anti debugging (basic principles of debugger Design & NT NP and other anti debugging principles)
- 面试汇总:这是一份全面&详细的Android面试指南
- C file in keil cannot be compiled
- 【无标题】
- Huawei MPLS experiment
- Thread Basics
- Kuboard
- 【做题打卡】集成每日5题分享(第三期)
猜你喜欢
Installation of postman and postman interceptor
grandMA2 onPC 3.1.2.5的DMX参数摸索
官宣!第三届云原生编程挑战赛正式启动!
【软件逆向-基础知识】分析方法、汇编指令体系结构
Thread Basics
ABP vNext microservice architecture detailed tutorial - distributed permission framework (Part 2)
面试汇总:这是一份全面&详细的Android面试指南
KVM virtualization
SPI and IIC communication protocol
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
随机推荐
企业级:Spire.Office for .NET:Platinum|7.7.x
v-if VS v-show 2.0
Why do some programmers change careers before they are 30?
FBO and RBO disappeared in webgpu
Share the newly released web application development framework based on blazor Technology
DECLARE_ WAIT_ QUEUE_ HEAD、wake_ up_ Interruptible macro analysis
函数基础学习02
【软件逆向-基础知识】分析方法、汇编指令体系结构
[luat-air105] 4.1 file system FS
[Chongqing Guangdong education] 2777t green space planning reference questions of National Open University in autumn 2018
A brief introduction to the behavior tree of unity AI
Zero foundation uses paddlepaddle to build lenet-5 network
Analysis of glibc strlen implementation mode
Share the newly released web application development framework based on blazor Technology
What is the most effective way to convert int to string- What is the most efficient way to convert an int to a String?
Kuboard
postman和postman interceptor的安装
Easy processing of ten-year futures and stock market data -- Application of tdengine in Tongxinyuan fund
An elegant program for Euclid‘s algorithm
Timing manager based on C #