Skip to main content
https://img.shields.io/badge/license-MIT-blue.svg

PyMySQLProxyCursor

A simple cursor wrapper to support before/after processing using PyMySQL.

Installation

The last stable release is available on PyPI and can be installed with pip:

$ pip install PyMySQLProxyCursor

Example

from __future__ import print_function

import pymysql
import proxycursor

class SimpleProxy(object):
    def __init__(self):
        self.tblname = 'user'

    def after_insert(self, **kwargs):
        cur = kwargs['cursor']
        cur.execute('SELECT LAST_INSERT_ID()')

    def after_update(self, **kwargs):
        cur = kwargs['cursor']
        cur.execute('SELECT * FROM user ORDER BY updated_at desc LIMIT 1')


conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='', db='mysql')

cur = conn.cursor()
cur = proxycursor.wrap(cur, handlers=[SimpleProxy()])
cur.execute("SELECT Host,User FROM user")

print(cur.description)

print()

for row in cur:
    print(row)

cur.close()
conn.close()

License

PyMySQLProxyCursor is released under the MIT License. See LICENSE for more information.

Metadata

Release files for PyMySQLProxyCursor 0.2.5

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

Source distribution (sdist)

Source distribution for PyMySQLProxyCursor 0.2.5
File Size Uploaded
PyMySQLProxyCursor-0.2.5.tar.gz 6.5 kB Details

Release files / PyMySQLProxyCursor-0.2.5.tar.gz

Download URL PyMySQLProxyCursor-0.2.5.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bbf4e18a3c070e3fcbdfbffcc43b65dbe484c9da26a94ec34e5ca820af30fafa
BLAKE2b-256 checksum
How to use checksums
4f379d6c0146b209b207affd3245c5d32f6af1c2e0ef515a8c57841b6e730baf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.5 This release

1 release file

0.2.4

1 release file

0.2.3

2 release files

0.2.2

2 release files

0.2.1

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