- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有一个问题叫做:Python best practice and securest to connect to MySQL and execute queries Kirk Strauser 先生说:
You can see which your client library supports by looking at the paramstyle module-level variable:
>>> clientlibrary.paramstyle
'pyformat'
但是当我在我的 python 3 上运行它时,我得到:
>>> clientlibrary.paramstyle
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'clientlibrary' is not defined
我也在pip中搜索过
pip3 search clientlibrary
<nothing>
我能做什么?
最佳答案
paramstyle 是任何 python 数据库模块所必需的(参见 PEP-249 ,clientlibrary 只是您正在使用的 datbase 模块的占位符。
例如
>>> import mysql.connector as clientlibrary
>>> clientlibrary.paramstyle
'pyformat
>>> import mariadb as clientlibrary
>>> clientlibrary.paramstyle
'qmark
关于python - clientlibrary.paramstyle 没有正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59291900/
有一个问题叫做:Python best practice and securest to connect to MySQL and execute queries Kirk Strauser 先生说:
我的默认 mysql 参数是:'format' >>>MySQLdb.paramstyle 'format' 我想将默认参数样式更改为“pyformat”,因为我可以查询类似“WHERE name=%
我有一个 Connection 实例(符合 DB API 2.0 要求),但我没有从中导入它的模块。问题是我正在尝试使用命名参数,但我不知道要使用哪个 paramstyle。 由于paramstyle
我正在实现一个 Python 本体类,它使用数据库后端来存储和查询本体。数据库模式是固定的(预先指定),但我不知道使用的是什么类型的数据库引擎。但是,我可以相信数据库引擎的 Python 接口(int
我使用 sqlalchemy 连接到 postgresql。当我尝试这段代码时: e = create_engine('') r = e.execute("select ?", 5) 它给了我: sq
在搜寻直到疯狂之后,我决定在这里发布一个问题。 我试图创建一个sqlite3数据库,在这里我想利用cursor.execute(SQL,param)函数的安全变量替换函数。我的功能是这样的: #!/u
我正在使用 Flask-Alchemy 针对 Cloud SQL 构建一个 GAE Flask 应用程序,并在构建应用程序时运行 dev_appserver 来测试该应用程序。 但是,如果我将 SQL
这个问题在这里已经有了答案: CS50: LIKE operator, variable substitution with % expansion (1 个回答) 关闭 3 年前。 我正在尝试进行
我是一名优秀的程序员,十分优秀!