Name | bettermysql JSON |
Version |
0.0.5
JSON |
| download |
home_page | None |
Summary | A simple and lightweight ORM that facilitate some operations on MySQL using of pymysql. |
upload_time | 2024-06-12 13:53:42 |
maintainer | None |
docs_url | None |
author | matgasp |
requires_python | >=3.9 |
license | None |
keywords |
better
better mysql
bettermysql
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# **About**
A simple and lightweight ORM that facilitate some operations on MySQL using of pymysql.
# How to use
## **Preparation**
```python
# 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**
```python
# 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**
```python
# Inserting a person given its name and age
People().insert("name, age").run(["Matt", 34])
```
## **Update**
```python
# Updating all ages to 16 where the name is Matt
People().update("age = ?").where("name = ?").run([16, "Matt"])
```
## **Delete**
```python
# Delete all people
People().delete()
```
Raw data
{
"_id": null,
"home_page": null,
"name": "bettermysql",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "better, better mysql, bettermysql",
"author": "matgasp",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/65/23/c09cb15a9b876cd0e97ca68c2e9231d6a8ed5dd9c8c158ff3f7043f67d9f/bettermysql-0.0.5.tar.gz",
"platform": null,
"description": "# **About**\n\nA simple and lightweight ORM that facilitate some operations on MySQL using of pymysql.\n\n# How to use\n\n## **Preparation**\n\n```python\n# Single call it once to setup the inner settings\nBetterMYSQL.setup(\"name of the database\", \"db user\", \"db password\", \"host\", 1234) #port\n\n# Creating a DB Model\nclass Fruits():\n _table = \"fruit_table_name\"\n\nclass People():\n _table = \"people_table_name\"\n```\n\n## **Select**\n\n```python\n# Select the first fruit ordered by name and retrieve the first row\nFruits().select(\"name\").order(\"name\").row() # returns one row\n\n# Select all data from the top 15 fruits\nFruits().select(\"*\").limit(\"15\").run() # returns a row list\n\n# Select all data from the top 15 fruits\nFruits().select(\"*\").limit(\"15\").run() # returns a row list\n\n# Select the name of the first person with 34 years old\nPeople().select(\"name\").where(\"age = ?\").cell(34) # returns the first cell of the first row\n```\n\n## **Insert**\n\n```python\n# Inserting a person given its name and age\nPeople().insert(\"name, age\").run([\"Matt\", 34])\n```\n\n## **Update**\n\n```python\n# Updating all ages to 16 where the name is Matt\nPeople().update(\"age = ?\").where(\"name = ?\").run([16, \"Matt\"])\n```\n\n## **Delete**\n\n```python\n# Delete all people\nPeople().delete()\n```\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple and lightweight ORM that facilitate some operations on MySQL using of pymysql.",
"version": "0.0.5",
"project_urls": {
"Issues": "https://github.com/matgasp/bettermysql/issues",
"Repository": "https://github.com/matgasp/bettermysql"
},
"split_keywords": [
"better",
" better mysql",
" bettermysql"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e0f86f6f2fb96464a116f42227ace689156234988aeb6c0c6218ad1420ea1216",
"md5": "3fb5b4ed83b382c44647218692fed005",
"sha256": "b21776e5969c388a45bbb4c68e175e71ab8bd530ac6ff93cfdec9020fab9a546"
},
"downloads": -1,
"filename": "bettermysql-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3fb5b4ed83b382c44647218692fed005",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 3610,
"upload_time": "2024-06-12T13:53:40",
"upload_time_iso_8601": "2024-06-12T13:53:40.657088Z",
"url": "https://files.pythonhosted.org/packages/e0/f8/6f6f2fb96464a116f42227ace689156234988aeb6c0c6218ad1420ea1216/bettermysql-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6523c09cb15a9b876cd0e97ca68c2e9231d6a8ed5dd9c8c158ff3f7043f67d9f",
"md5": "78a6afb057878e340222f894a087f2dc",
"sha256": "342a2a6d392039e4b354dfdd567ccd188faea0dde71866526b6bbeffe0d38822"
},
"downloads": -1,
"filename": "bettermysql-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "78a6afb057878e340222f894a087f2dc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 3357,
"upload_time": "2024-06-12T13:53:42",
"upload_time_iso_8601": "2024-06-12T13:53:42.024696Z",
"url": "https://files.pythonhosted.org/packages/65/23/c09cb15a9b876cd0e97ca68c2e9231d6a8ed5dd9c8c158ff3f7043f67d9f/bettermysql-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-12 13:53:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "matgasp",
"github_project": "bettermysql",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "bettermysql"
}