Skip to main content

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)

## Print Query Example

users=table("users")
users.printQuery=True
res=users.fromTable('users.pk').leftJoin('images','user_id=users.pk').where('users.pk=27').limit(50,0).all()

for v in res:   
    print(res)

## Sub Query Example

users=table("users")
users.printQuery=True
users.subQuery("(select count(*) from users ) as m,")
res=users.fromTable('users.pk').leftJoin('images','user_id=users.pk').where('users.pk=27').limit(50,0).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@gmail.com

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

mysql_fastconnector-0.0.3.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

mysql_fastconnector-0.0.3-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file mysql_fastconnector-0.0.3.tar.gz.

File metadata

  • Download URL: mysql_fastconnector-0.0.3.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for mysql_fastconnector-0.0.3.tar.gz
Algorithm Hash digest
SHA256 cfb3c8aad051bad45145736ec29066aab968e4c33640fb03e123282541602fca
MD5 d27b2a07521cbee2980634c71862f114
BLAKE2b-256 a227e92c55efe3de7046a8d0a4f539875e9302e055080f1eaa75f7e124c5099f

See more details on using hashes here.

File details

Details for the file mysql_fastconnector-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mysql_fastconnector-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dfab45945aa42d19ca1a5118c74f71ec7b9e7ff1ed0c449fa62f9efcdbcd2b56
MD5 b9b8a451eb9831faa40738a7eddbafcb
BLAKE2b-256 fc3a531a6cac3513c41c5468f4c65f8feac3d7a38eec458e4a055512e0318245

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page