1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.
mageia
This is a simple database tools for MySQL
- Based on SQLAlchemy
- Transaction-Safe
- Friendly interface for developer
- Use
:paramsyntax bind param
Documentation
pip install mageia
Usage
from mageia.db import DB, create_engine, Dict
url = "mysql+pymysql://root:password@localhost/info?charset=utf8"
# create a engine instance, and DB instance
engine = create_engine(url)
db = DB(engine)
Query
# return [dict-like,dict-like,dict-like,] or None
user_list = db.query("select * from user where id=:id", id = 1)
user_list = db.query("select * from user where id in :id", id = [1,2,3])
user = user_list[0]
print(user.id)
print(user.name)
Query One
# return dict-like or None
db.query_one("select * from user where id=:id", id = 1)
Query Page
# return [dict-like,dict-like,dict-like,] or None
user = db.query_page("select * from user", page=1, limit=10)
Insert
Jack = {
"name":"Jack",
"age":18,
"sex":1
}
table = "user"
# Insert done, don't need commit
db.add(table, Jack)
Insert Many
Jack = {
"name":"Jack",
"age":18,
"sex":1
}
Tom = {
"name":"Tom",
"age":18,
"sex":1
}
table = "user"
db.add_many(table, [Tom,Jack])
Delete
data = db.query_one("select * from user where id = :id", id=1)
# Delete done, don't need commit, data must contain a primary key ,etc id .
db.delete("user", data)
Merge
data = db.query_one("select * from user where id = :id", id=1)
# merge done, don't need commit, data must contain a primary key ,etc id .
data.name = "stefanlei"
db.merge("user",data)
Merge many
user_list = db.query("select * from user where id in :ids", ids=[1, 2, 3, 4, 5, 6, 7, 8])
for user in user_list:
user.name = "stefanlei"
db.merge_many("user", user_list)
Execute
# return affected rows total
db.execute("delete from user where id = 1")
db.execute("update user set age = 18 where age = :age", age=16)
Transaction-Safe
You can also use session to keep Transaction-Safe
# Use session to keep transaction-safe
with db.session() as s:
db_user = s.query_one("select * from user")
s.delete("user", db_user)
user = Dict()
user.name = "stefan"
user.age = 18
s.add("user", user)
Metadata
Release files for mageia 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
File added late
1 file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mageia-0.1.5.tar.gz | 3.8 kB | Without provenance | Details for mageia-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mageia-0.1.5-py3.7.egg | Legacy Egg format | - | - | Details for mageia-0.1.5-py3.7.egg |
Total release size: 19.7 kB
Release files / mageia-0.1.5.tar.gz
| Download URL | mageia-0.1.5.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8e6bdfded63cc569d3fc364a066d02b729ad345c04c8ca7d72f3be8aada0334
|
|
BLAKE2b-256 checksum How to use checksums |
75372322842ed7a45980541e59362680776d381c18873573001b7afc1871821b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.9.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
|
Release files / mageia-0.1.5-py3.7.egg
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | mageia-0.1.5-py3.7.egg |
|---|---|
| Size | 15.8 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
e1c9d09b21afa93931cbcee6450274c89e14f0b4cf53fc9e9e133e6ec2357335
|
|
BLAKE2b-256 checksum How to use checksums |
ffd60ee265fdf47ff34404cb458e740715edbee5333a5953872c117be8a90760
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.10
|
Security for mageia 0.1.5
Upload timing
Release file added late
1 file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.