当前位置:网站首页>已解决(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
边栏推荐
- JWT vulnerability recurrence
- [groovy] loop control (number injection function implements loop | times function | upto function | downto function | step function | closure can be written outside as the final parameter)
- Kbp206-asemi rectifier bridge kbp206
- An elegant program for Euclid‘s algorithm
- Talk about the SQL server version of DTM sub transaction barrier function
- Multimedia query
- Daily question 2 12
- IronXL for .NET 2022.6
- Kubernetes - Multi cluster management
- Class inheritance in C #
猜你喜欢
UE4 DMX和grandMA2 onPC 3.1.2.5的操作流程
程序员的视力怎么样? | 每日趣闻
Subversive cognition: what does SRE do?
【web审计-源码泄露】获取源码方法,利用工具
[software reverse - basic knowledge] analysis method, assembly instruction architecture
[2022 repair version] community scanning code into group activity code to drain the complete operation source code / connect the contract free payment interface / promote the normal binding of subordi
[groovy] loop control (number injection function implements loop | times function | upto function | downto function | step function | closure can be written outside as the final parameter)
IronXL for .NET 2022.6
官宣!第三届云原生编程挑战赛正式启动!
花了2晚,拿到了吴恩达@斯坦福大学的机器学习课程证书
随机推荐
Asemi rectifier bridge 2w10 parameters, 2w10 specifications, 2w10 characteristics
Clickhouse同步mysql(基于物化引擎)
New interesting test applet source code_ Test available
040. (2.9) relieved
The architect started to write a HelloWorld
[groovy] loop control (number injection function implements loop | times function | upto function | downto function | step function | closure can be written outside as the final parameter)
SQL performance optimization skills
Analysis of glibc strlen implementation mode
SQL performance optimization skills
请问一下我的请求是条件更新,但在buffer中就被拦截了,这种情况我只能每次去flush缓存么?
error Couldn‘t find a package.json file in “你的路径“
Cette ADB MySQL prend - elle en charge SQL Server?
Basic function learning 02
NEW:Devart dotConnect ADO.NET
Anti debugging (basic principles of debugger Design & NT NP and other anti debugging principles)
Kubernetes - identity and authority authentication
LeetCode 234. Palindrome linked list
[move pictures up, down, left and right through the keyboard in JS]
【软件逆向-基础知识】分析方法、汇编指令体系结构
[learning notes] month end operation -gr/ir reorganization