donthitmyface
donthitmyface

Reputation: 13

clientlibrary.paramstyle is not working like it should

There is a question called : Python best practice and securest to connect to MySQL and execute queries an there Mr. Kirk Strauser says:

You can see which your client library supports by looking at the paramstyle module-level variable:

>>> clientlibrary.paramstyle
'pyformat'

But when I run this on my python 3 I get :

>>> clientlibrary.paramstyle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'clientlibrary' is not defined

I also searched in pip

pip3 search clientlibrary
<nothing>

what can I do ?

Upvotes: 1

Views: 131

Answers (1)

Georg Richter
Georg Richter

Reputation: 7486

The paramstyle is required for any python database module (see PEP-249, the clientlibrary is just a placeholder for the datbase module you're using.

E.g.

>>> import mysql.connector as clientlibrary
>>> clientlibrary.paramstyle
'pyformat
>>> import mariadb as clientlibrary
>>> clientlibrary.paramstyle
'qmark 

Upvotes: 1

Related Questions