semvec/pypi-packages huggingface dataset:
sqlx-orm 0.0.7
A single table ORM framework for python. Support MySQL, PostgreSQL, SQLite etc.
Requires Python: >=3.6
Keywords: SQL, MySQL, PostgreSQL, SQLite, Database, Python, RDB

Usage Sample
''''''''''''

.. code:: python

    from orm import Model, db
    from typing import List, Tuple, Mapping

    class Person(Model):
        __pk__ = 'id'
        __table__ = 'person'

        def __init__(self, id: int = None, name: str = None, age: int = None):
            self.id = id
            self.name = name
            self.age = age


    if __name__ == '__main__':
        db.init('test.db', driver='sqlite3', show_sql=True, debug=True)
        db.init_db("postgres://user:password@127.0.0.1:5432/testdb", driver='psycopg2', pool_size=5)
        db.init_db(host='127.0.0.1', port='3306', user='xxx', password='xxx', database='test', pool_size=5, show_sql=True)

        effected_rowcount = Person.insert(name='tianqi', age=77)

        persons = Person.query(name='tianqi')
        # select id, name, age from person where name = :name
        # result:
        # {'id': 7, 'name': 'tianqi', 'age': 77}

        persons = Person.query(name__eq='zhangsan')
        # select id, name, age from person where name = :name
        # result:
        # [{'id': 3, 'name': 'zhangsan', 'age': 15}]

Transaction
'''''''''''

.. code:: python

    from orm import with_transaction, transaction

    @with_transaction
    def test_transaction():
        insert_func(....)
        update_func(....)


    def test_transaction2():
        with transaction():
            insert_func(....)
            update_func(....)


If you want to operate MySQL database, may be you need MySqlx: https://pypi.org/project/mysqlx

If you want to operate PostgreSQL database, may be you need MySqlx: https://pypi.org/project/pgsqlx

If you just wanted a simple sql executor, may be you need sqlx-exec: https://pypi.org/project/sqlx-exec
sqlx-executor 1.1.6
A simple thread safe sql executor for Python with connection pool. Support MySQL, PostgreSQL, SQLite etc.
Requires Python: >=3.6
Keywords: SQL, MySQL, PostgreSQL, SQLite, Database, Python, RDB

Usage Sample
''''''''''''

.. code::

       import executor as db

       if __name__ == '__main__':
          db.init('test.db', driver='sqlite3', debug=True)

          # or
          db.init("postgres://user:password@127.0.0.1:5432/testdb", driver='psycopg2', pool_size=5, debug=True)

          # or
          db.init(host='127.0.0.1', port='5432', user='xxx', password='xxx', database='testdb', driver='psycopg2')

          # if driver is 'pymysql' or 'mysql.connector' of MySQL, the select_key is 'SELECT LAST_INSERT_ID()'
          select_key = "SELECT currval('person_id_seq')"

          id = db.save(select_key, 'INSERT INTO person(name, age) VALUES(%s,%s)', 'wangwu', 38)

          persons = db.select('select id, name, age from person')
          # result:
          # (3, 'zhangsan', 15)
          # (4, 'lisi', 26)
          # (5, 'wangwu', 38)
          # (6, 'zhaoliu', 45)

          persons = db.select_one('select id, name, age from person where name = %s', 'zhangsan')
          # result:
          # (3, 'zhangsan', 15)

          args = [
           ('李四', 55),
           ('王五', 35),
          ]
          db.batch_execute('INSERT INTO person(name,age) VALUES(%s,%s)', *args)

          db.close()

Transaction
''''''''''''

.. code::

       from executor import with_transaction, transaction

       @with_transaction
       def test_transaction():
          insert_func(....)
          update_func(....)


       def test_transaction2():
          with transaction():
              insert_func(....)
              update_func(....)