Skip to main content

Usage:

# pip install my4geks
import gevent.monkey ; gevent.monkey.patch_all()
from my4geks import db, db_config, db_transaction

db_config.update(user='user', password='password', database='test')
    # Defaults: host='127.0.0.1', port=3306, pool_size=10, query_timeout=55, charset='utf8', cursor_class=AdictCursor.

def on_request(): # Inside a greenlet:

    item = db('SELECT * FROM `items` WHERE `id` = %s', item_id, charset='utf8mb4').row

    for item in db('SELECT `id`, `name` FROM `items` WHERE `name` IN %s, [value1, value2]).rows:
        print('{}   {}'.format(item.id, item.name))

    assert db('UPDATE `items` SET `name` = %s WHERE `name` = %s', new_value, old_value).affected # rowcount

    def code():
        db('INSERT INTO `table1` (`quantity`) VALUES (%s)', -100)
        db('INSERT INTO `table2` (`quantity`) VALUES (%s)', +1/0)
    db_transaction(code)

Metadata

Release files for my4geks 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for my4geks 0.1.6
File Size Uploaded
my4geks-0.1.6.tar.gz 3.5 kB Details

Release files / my4geks-0.1.6.tar.gz

Download URL my4geks-0.1.6.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a05b48e82d9c90184c3698e5cd342bb0aabddf05d39655bddabae4167b40f074
BLAKE2b-256 checksum
How to use checksums
bdb2e74abad9d0fc781c412eb7a3bccc5d11ff1b607457bbe82b77cf304681a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.6 This release

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page