当前位置:网站首页>已解决(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
边栏推荐
- Blue Bridge Cup single chip microcomputer -- PWM pulse width modulation
- Talk about the SQL server version of DTM sub transaction barrier function
- Smart pointer shared_ PTR and weak_ Difference of PTR
- Flex flexible layout
- Some enterprise interview questions of unity interview
- Clickhouse同步mysql(基于物化引擎)
- Logstash、Fluentd、Fluent Bit、Vector? How to choose the appropriate open source log collector
- [learning notes] month end operation -gr/ir reorganization
- [positioning in JS]
- New interesting test applet source code_ Test available
猜你喜欢
Jd.com 2: how to prevent oversold in the deduction process of commodity inventory?
[groovy] string (string type variable definition | character type variable definition)
PlasticSCM 企业版Crack
Learning notes of raspberry pie 4B - IO communication (I2C)
【无标题】
Use of kubesphere configuration set (configmap)
JWT vulnerability recurrence
Asemi rectifier bridge 2w10 parameters, 2w10 specifications, 2w10 characteristics
Zero foundation uses paddlepaddle to build lenet-5 network
程序员的视力怎么样? | 每日趣闻
随机推荐
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Redis6-01nosql database
postman和postman interceptor的安装
NEW:Devart dotConnect ADO.NET
Nmap使用手册学习记录
DECLARE_ WAIT_ QUEUE_ HEAD、wake_ up_ Interruptible macro analysis
Redis source code analysis: redis cluster
Anti debugging (basic principles of debugger Design & NT NP and other anti debugging principles)
51 independent key basic experiment
[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
【web審計-源碼泄露】獲取源碼方法,利用工具
[groovy] string (string injection function | asBoolean | execute | minus)
Technology sharing swift defense programming
Unity implements the code of the attacked white flash (including shader)
Excuse me, my request is a condition update, but it is blocked in the buffer. In this case, can I only flush the cache every time?
深度学习——LSTM基础
UE4 DMX和grandMA2 onPC 3.1.2.5的操作流程
Cette ADB MySQL prend - elle en charge SQL Server?
[vérification sur le Web - divulgation du code source] obtenir la méthode du code source et utiliser des outils
Talk about the SQL server version of DTM sub transaction barrier function