it helps to connect mysql and do CURD action easily
Project description
## Required Mysql client and connector
pip install mysqlclient pip install mysql-connector-python pip install pymysql
## Mysql Database connection example
from mysql_fastconnector import Model ,table,query
obj=Model.connect({'host': "127.0.0.1",'user': "username",'password': "password",'db': "dbname"})
## Mysql Query Example
```python
res=query("select * from users").fetchAll()
for v in res:
print(res)
Object based Query Example
res=table("players").all()
res=table("players").one()
res=table("players").fromTable('pk').where('pk=37').all()
res=table("players").fromTable('pk').where('pk=37').limit(0,50).all()
res=table("players").fromTable('players.pk').leftJoin('player_images','player_id=players.pk').where('players.pk=37').limit(0,50).all()
res=table("players").fromTable('players.pk').rightJoin('player_images','player_id=players.pk').where('players.pk=37').limit(0,50).all()
for v in res:
print(res)
Insert Example
id=obj.table("players").insert({'first_name':'r222222222','last_name':'r33333333','id':'555','email':'aa@gmail.com','mobile':'987654321'}).getId()
print(id)
ids=obj.table("players").insertMany([{'first_name':'r222222222','last_name':'r33333333','id':'555','email':'aa@gmail.com','mobile':'987654321'},{'first_name':'r222222223333333333','last_name':'r33333333','id':'555','email':'aa@gmail.com','mobile':'987654321'}])
print(ids)
update Example
id=obj.table("players").update({'first_name':'0000000000000000000','last_name':'r33333333','id':'555','email':'aa@gmail.com','mobile':'987654321'},"pk=66")
delete Example
table("players").delete("pk=66")
Any help , contact me
email : ilayaraja.python@gmil.com
References
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mysql_fastconnector-0.0.2.tar.gz
.
File metadata
- Download URL: mysql_fastconnector-0.0.2.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b09f09350be3a14288e5d7857a8895e794b3bdc9ef6e98bad63439b5c7888e63 |
|
MD5 | 2ab9d61c1508f758756def61fd583c92 |
|
BLAKE2b-256 | 47f96738a2dac58e7800397185eadf14a67c075cca3e8cab7aa8f0a1ba3439bc |
File details
Details for the file mysql_fastconnector-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: mysql_fastconnector-0.0.2-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2386360216246941f40a10d67e7a39358085ed96514c17c6be844c2bf3ba322f |
|
MD5 | 37a0b3b4bed867c892602b586ea34d45 |
|
BLAKE2b-256 | 0c26989205af4d19741c479bc01ef8997cd68cc8cfcfa3d9141df23f41b357c9 |