Wrapper não oficial do mysql-connector
Project description
wrapper to mysql-connector
- close and open connection
@name_task-> your def - connected() return connection in
MySQL - get_cursor() return instance of
cursor - desconected() return bool for
connectionsucess or fail - ClassConnection() ->
constructorofMySQLConnector
EXAMPLE:
from wrapper import ClassConnectionparams = {
'host':'your_host',
'user':'your_user',
'password':'your_password',
'port':3306,
}
params = {
'host':'your_host',
'user':'your_user',
'password':'your_password',
'port':3306,
}
cls = ClassConnection(\*\*params)
conn = cls.connected()
cur = cls.get_cursor()cur.execute('your_operation_sql')
conn.commit()
EXAMPLE 2:
from wrapper import ClassConnectionparams = {
'host':'your_host',
'user':'your_user',
'password':'your_password',
'port':3306,
}cls = ClassConnection(\*\*params)
conn = cls.connected()
cur = cls.get_cursor()@cls.query
def select_all(table)
cur.execute(f'select \* from {table}') # autoclosing cursor and connection@cls.update
def update(table,column,value,id)
cur.execute(f'update {table} set {column} = {value} where id = {id}') # autoclosing cursor and connection and autocommit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file wrapper_mysql_connector-0.0.2.tar.gz.
File metadata
- Download URL: wrapper_mysql_connector-0.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64927a11e97989227d3aa459aaf9fc28fc3bfe299b60450229326a693b24ece1
|
|
| MD5 |
ae166f333392ab56bff9c1e217348778
|
|
| BLAKE2b-256 |
be5208da322c5cf02fdb46aeccd3f000a0c4e6315a56a92ee3570d92f2465765
|