A simple and lightweight ORM that facilitate some operations on MySQL using of pymysql.
Project description
About
A simple and lightweight ORM that facilitate some operations on MySQL using of pymysql.
How to use
Preparation
# Single call it once to setup the inner settings
BetterMYSQL.setup("name of the database", "db user", "db password", "host", 1234) #port
# Creating a DB Model
class Fruits():
_table = "fruit_table_name"
class People():
_table = "people_table_name"
Select
# Select the first fruit ordered by name and retrieve the first row
Fruits().select("name").order("name").row() # returns one row
# Select all data from the top 15 fruits
Fruits().select("*").limit("15").run() # returns a row list
# Select all data from the top 15 fruits
Fruits().select("*").limit("15").run() # returns a row list
# Select the name of the first person with 34 years old
People().select("name").where("age = ?").cell(34) # returns the first cell of the first row
Insert
# Inserting a person given its name and age
People().insert("name, age").run(["Matt", 34])
Update
# Updating all ages to 16 where the name is Matt
People().update("age = ?").where("name = ?").run([16, "Matt"])
Delete
# Delete all people
People().delete()
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
bettermysql-0.0.5.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bettermysql-0.0.5.tar.gz.
File metadata
- Download URL: bettermysql-0.0.5.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
342a2a6d392039e4b354dfdd567ccd188faea0dde71866526b6bbeffe0d38822
|
|
| MD5 |
78a6afb057878e340222f894a087f2dc
|
|
| BLAKE2b-256 |
6523c09cb15a9b876cd0e97ca68c2e9231d6a8ed5dd9c8c158ff3f7043f67d9f
|
File details
Details for the file bettermysql-0.0.5-py3-none-any.whl.
File metadata
- Download URL: bettermysql-0.0.5-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b21776e5969c388a45bbb4c68e175e71ab8bd530ac6ff93cfdec9020fab9a546
|
|
| MD5 |
3fb5b4ed83b382c44647218692fed005
|
|
| BLAKE2b-256 |
e0f86f6f2fb96464a116f42227ace689156234988aeb6c0c6218ad1420ea1216
|